EA on this indicator

 

HI, I would build an EA on this indicator,

trade rules: BUY on green bar of the indicator

SELL in red bar of the indicator

EXIT in stop loss or in opposite signal (exit buy on red bar with simoultaneously open sell, and viceversa)

EXIT even in case of yellow bar of the indicator, and re-entry on next bar


Any cross, any timeframe, stoploss and takeprofit variables


Anyone can help me? Thank you SO MUCH


here the indicator

Files:
 
Maybe I can, but I need to know the exact rules that you want to, the rules you listed above is not detailed enough to code a EA, as it will generate lots of noise signal, please provide more details
 
evanto219:
Maybe I can, but I need to know the exact rules that you want to, the rules you listed above is not detailed enough to code a EA, as it will generate lots of noise signal, please provide more details

Thank you so much evanto,

the indicator shows many objects, but objects that interest me are the vertical bars.

These bars could be Green, Red, or Yellow.


I would simply enter LONG when the indicator shows a green bar, and hold the position until it comes out a red bar. When the indicator shows a red bar, the LONG position close and open a SHORT position. Stop and Reverse, so...


Sometime comes out a yellow bar, that means caution. In this case, I would EXIT by any position and re-entry on the next bar. (if possible I would have this function like extern variable, to choose True or False, and backtest it)


These are the only rules. I would select like extern variable even SL, TP, and LotSize. And apply the EA on any cross and any Timeframe. Obviously in m5 we have a signal every 5 minutes, on h1 we have signals every 1 hour, etc.


What other details you need?


Thank you again!!

 
Oh, I forgot...mql4 language, NOT mql5. I dont know if it's important
 

Michael,


Attached is EA which is based on your rules, but please note that the indicator repaint, in another word, a green bar could be a red bar or yellow bar before it's completed. For EA based on repainting indicator, you should not use 100% automatically, using manual confirmation mode when running this EA would be better.


Furthermore, the TriggerLevel in your indicator is 52, which I think is a little bit small to trigger a trade signal, increase the value of the TriggerLevel will provide more stable signal, so I change it to 55, but please try other value by yourself and maybe you will find a better one. and higher Timeframe will also provide more stable signal, of cause, the timing will be delayed if higher Timeframe.


other info, please see below.


extern double Lots = 0.1; //you can change the LotSize

extern int StopLoss=30; // SL setting when placing order

extern double TakeProfit = 50; // TP setting when placing order

extern double TrailingStop = 30; // TraillingStop trigger point

extern int TriggerLevel = 55; // TriggerLevel, you can try other value

extern bool ExitYellowBar=false; // if true, close any position when there is a yellow bar


Evan

Files:
 

WOW Evan, thank you VERY VERY MUCH!!!


In effect, the last bar could change color until the timeframe bar hasn't closed, but this is normally, and the function of yellow bar is just that: Indicate a change in the signal of indicator. Fo this reason I want to exit on yellow and re-enter in the next bar.


I will try immediately the EA and I will return to write for proposing any changes.


I hope that you can make profit from this EA :)


Thank you! And have a nice day!


Michael

 

Ok Evan, the EA works and works fine :)


Two things:

-The indicator shows about 32 bars on the chart and in backtest the EA work only on these bars, and not in back period.

Would be possible to backtest in previous period?


-Would be possible to insert even a Periodical Trailing Stop, a stop loss that's updated every time the bar is closed and not at each pip, and choose between this and classical trailing stop in extern variable?


I hope don't ask too much and don't disturb you, but I think could come out something good from this EA.


THANK YOU

 

Michael,


1. The indicator always display the latest 32 bars and it works normally in the backtest, the first signal should be always ignored.

2. As mentioned above, the EA should be run in a manual mode due the signal changes before the bar ends, so the trailing stop will be watched closely when working. I think the most convenient way to turn off the EA if the profit is increasing, or just turn off the trailing stop mode by set the value to 0 (zero).

Evan

 
Ok Evan, and it would be possible to analyze the signal at each open bar instead of continuously? This will solve the problem of the last repaint bar.

I would let him work automatically because if I have to follow manually, I don't need an EA :)
 
mobyfx:
Ok Evan, and it would be possible to analyze the signal at each open bar instead of continuously? This will solve the problem of the last repaint bar.

I would let him work automatically because if I have to follow manually, I don't need an EA :)

Michael,


there is two options if you want to let it work without manually monitoring.


1. Change the trading rules due to the last repaint bar

2. Improving the Indicator, make it not changing the color.


I don't think it's a good idea to use the open price to analyze the indicator if you want 100% automatically EA, the Every Tick backtest Mode is the real world.


Evan

 
evanto219:

Michael,


there is two options if you want to let it work without manually monitoring.


1. Change the trading rules due to the last repaint bar

2. Improving the Indicator, make it not changing the color.


I don't think it's a good idea to use the open price to analyze the indicator if you want 100% automatically EA, the Every Tick backtest Mode is the real world.


Evan






Yes, I know, in fact I don't say select Open Price in the mt4 tester, but code the EA for check signal only at new bar. So the EA will read only the first color of bar.


Furthermore I saw that in backtest, the EA don't trade all orders but many times, for example, close a LONG and don't enter SHORT, but wait for the next long signal and re-entry LONG...

I would a simple stop and reverse strategy, and maybe we can try also with signal check at open bar.


Is it right?


Thank you so so much again for the help

Reason: