Ea trades during candle instead of the close - page 2

 
traderdukeFX wrote >>
forget how to attach

Picture of problem

 
traderdukeFX:

This is a good working HMA EA except for one thing, it it buys or sells during the candle as it changes which could do a short then the candle turns long and at the close your short with a long trend. I would like the buy or sell desicion to take place at the end of each candle not during.

Can some one help me with this problem.

It seems like RK-MAD-Heiken_Ashi_Ma_T3_new[Alert] indicator is missing.......

 
val77:

It seems like RK-MAD-Heiken_Ashi_Ma_T3_new[Alert] indicator is missing.......

You can't compare Bars to a static. Once Bars reaches the maximum (in options) it won't change.

 

Hi

I think you missed the point WHRoeder was making. All the code you want to execute only when there's a new bar must go inside the if() block. I've rearranged WHR's code a little to illustrate.


int Start() {
   static datetime Time.newBar;
   bool newBar	= (Time[0] > Time.newBar);
   if (newBar) { // A new bar began.
      Time.newBar	= Time[0];			 // Reset static.
      //...                                 <<<< Any code here is executed only when a new bar appears
   }
   //...                                    <<<< Any code here is still executed every tick


Cheers

Jellybean

 
Jellybean wrote >>

Hi

I think you missed the point WHRoeder was making. All the code you want to execute only when there's a new bar must go inside the if() block. I've rearranged WHR's code a little to illustrate.

Cheers

Jellybean

WHRoeder thanks for the input and & Jellybean Thanks for the explaination. Now it works great in backtesting but fails to trade LIVE. All the false signals in the strategy tester disappeared, it increased Prof factor, Net profet and with less trades. If I remove the inputs at line 145 it will trade as usual. Any Ideas ???

Attached is the EA and the Indicator.

Thanks

 
traderdukeFX wrote >>

WHRoeder thanks for the input and & Jellybean Thanks for the explaination. Now it works great in backtesting but fails to trade LIVE. All the false signals in the strategy tester disappeared, it increased Prof factor, Net profet and with less trades. If I remove the inputs at line 145 it will trade as usual. Any Ideas ???

Attached is the EA and the Indicator.

Thanks

Here is the indicator. How do you attach 2 files at the same time??

 
traderdukeFX wrote >>

WHRoeder thanks for the input and & Jellybean Thanks for the explaination. Now it works great in backtesting but fails to trade LIVE. All the false signals in the strategy tester disappeared, it increased Prof factor, Net profet and with less trades. If I remove the inputs at line 145 it will trade as usual. Any Ideas ???

Attached is the EA and the Indicator.

Thanks

Here is the EA.

 
traderdukeFX wrote >>

Here is the EA.

It appears that MQL adds letters and symbols to the file names the indicator is "RK-MAD-Heiken_Ashi_Ma_T3_new[Alert]" and the EA is "RK_MAD_Heiken Ashi MA T3-test". Maybe its me.

Reason: