Hi All,
I am trying to use a very simple moving average cross strategy and I almost have everything done but do not know how to go about the entries and exits. Below is what I want to do.
For example: If a bar closes above a moving average go long at -.05 points stop but if this does not trigger or the price does not pull back for a more advantageous trade, go long on the close of this or next candle. Essentially, I want the code to look for a more advantageous entry within the opened bar but if the bar does not pull back all the way back to my designated entry point (-05), then open a long at the close of the bar.
Information to speed up the Help Process by TJ:
1. I am using MC 9.1
2. Oanda is my broker
3. The instrument is the USDJPY
4. Using the 1hr. timeframe (but I do not believe this has anything to do with what I need)
5. No problems observed so far, just do not know how to code this.
6. What want to do is described above.
Thank you All.
Entry on Pullback, if not Entry on Close of Bar
- TJ
- Posts: 7774
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
This is a good start. You have assembled a lot of the pertinent information.Hi All,
I am trying to use a very simple moving average cross strategy and I almost have everything done but do not know how to go about the entries and exits. Below is what I want to do.
For example: If a bar closes above a moving average go long at -.05 points stop but if this does not trigger or the price does not pull back for a more advantageous trade, go long on the close of this or next candle. Essentially, I want the code to look for a more advantageous entry within the opened bar but if the bar does not pull back all the way back to my designated entry point (-05), then open a long at the close of the bar.
Information to speed up the Help Process by TJ:
1. I am using MC 9.1
2. Oanda is my broker
3. The instrument is the USDJPY
4. Using the 1hr. timeframe (but I do not believe this has anything to do with what I need)
5. No problems observed so far, just do not know how to code this.
6. What want to do is described above.
Thank you All.
What do you mean by "I almost have everything done"?
- TJ
- Posts: 7774
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
Hi TJ,
What I meant by "I almost have everything done" is really that MC has done most of the job for me. I will be using their pre-installed Moving average cross code.
Thank you.
Do you know how to progarm in EasyLanguage?
- TJ
- Posts: 7774
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
There are 2 things you need to learn:
1. Parse your concept into pseudo code. This is the first step in writing codes.
eg. take your mumble jumble...
Rewrite your convoluted "concepts" into one-liners.
-- One thought per line
-- One action per line
Because the computer is dumb, it can only do one thing at a time.
After you have done the above,
you can attempt to convert thoughts into codes.
ps. it is at this time that you might discover your "one concept per line" actually contains multiple concepts or actions. These lines will need to break down further into multiple "single-concept" lines.
1. Parse your concept into pseudo code. This is the first step in writing codes.
eg. take your mumble jumble...
parse into pseudo code...If a bar closes above a moving average go long at -.05 points stop but if this does not trigger or the price does not pull back for a more advantageous trade, go long on the close of this or next candle. Essentially, I want the code to look for a more advantageous entry within the opened bar but if the bar does not pull back all the way back to my designated entry point (-05), then open a long at the close of the bar.
Code: Select all
If a bar closes above a moving average
then go long at -.05 points stop;
if this does not trigger above a moving average
or
if the price does not pull back for a more advantageous trade,
then
go long on the close of this candle
or
go long on the close of next candle;
-- One thought per line
-- One action per line
Because the computer is dumb, it can only do one thing at a time.
After you have done the above,
you can attempt to convert thoughts into codes.
ps. it is at this time that you might discover your "one concept per line" actually contains multiple concepts or actions. These lines will need to break down further into multiple "single-concept" lines.
- TJ
- Posts: 7774
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
2. Draw a flow chart to illustrate your logic.
If you can visualize your logic flow, you can easily code it with step-by-step syntax.
If you can visualize your logic flow, you can easily code it with step-by-step syntax.