Entry on Pullback, if not Entry on Close of Bar

Questions about MultiCharts and user contributed studies.
bryan1618
Posts: 12
Joined: 01 Nov 2016
Has thanked: 7 times

Entry on Pullback, if not Entry on Close of Bar

Postby bryan1618 » 01 Nov 2016

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.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Entry on Pullback, if not Entry on Close of Bar

Postby TJ » 01 Nov 2016

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.
This is a good start. You have assembled a lot of the pertinent information.


What do you mean by "I almost have everything done"?

bryan1618
Posts: 12
Joined: 01 Nov 2016
Has thanked: 7 times

Re: Entry on Pullback, if not Entry on Close of Bar

Postby bryan1618 » 01 Nov 2016

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.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Entry on Pullback, if not Entry on Close of Bar

Postby TJ » 01 Nov 2016

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?

bryan1618
Posts: 12
Joined: 01 Nov 2016
Has thanked: 7 times

Re: Entry on Pullback, if not Entry on Close of Bar

Postby bryan1618 » 01 Nov 2016

I am a beginner. I know a few of the basics. I have been studying the easylanguage essentials and functions and reserved words that I downloaded from MC.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Entry on Pullback, if not Entry on Close of Bar

Postby TJ » 01 Nov 2016

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...
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.
parse into pseudo code...

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;
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.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Entry on Pullback, if not Entry on Close of Bar

Postby TJ » 01 Nov 2016

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.

Image

bryan1618
Posts: 12
Joined: 01 Nov 2016
Has thanked: 7 times

Re: Entry on Pullback, if not Entry on Close of Bar

Postby bryan1618 » 01 Nov 2016

Thank you for your time TJ.

I will attempt to write this by implementing what you have shown me.


Return to “MultiCharts”