[HELP] Creating EA for Breakout with Custom Trade Execution Time

 
Dear all,

I'm a new member here and i'm new too in MQL Programming, but i have some knowledges about programming in high school. Here, i want to make an EA that is using breakout as the basic. So, this EA will calculate the range of high and low from 14:00 to 16.15 server time plus 6 spreads both sides. If the range is below 70, then it will set one BUY STOP at the high+spread with TP 1x the range and SL 0.5x the range, same will happen with SELL STOP (the idea is to make R:R=1:2 so that hopefully with only 50% win rate we will still get some money). One important thing this EA need to do is to set the PENDING ORDER not on 16:15 time, but on 16:30 time. And then, when one pending order is executed, we don't cancel the opposite. We only delete the remaining pending order(s) at the 13:59 the next day (before we start calculate the range again).

I have tried to build this EA using freely available breakout EA called BSL breakout. The copyright sectiom implies that i can modify, rename the name, as long as i dont delete the copyright section. So i build my EA from that. I have managed to calculate the range, set the proper positioning size, and to delete the remaining pending orders in the next day. I even managed to get succeed backtesting it from Jan '10 to May '10 with some decent success.

The problem is:
# while the EA can run smoothly and properly on backtesting, i can't make it run on live account on my VPS (using same broker and same setting of course). The EA doesnt open any pending orders on 16:30 as it did in the backtest. This problem I can't get over it. I really need any comments, suggestions, or anything here..

Thanks..

PS : I attached one zip file containing the ORIGINAL BSL BREAKOUT and my version of modification.
Files:
 
Have you checked the journal / log for any errors?
 
@msbusinessil: yes i have checked the journal and i didnt found any errors there..it just told me that the EA is loaded and initialized...

any other idea?
 
hoedha:
@msbusinessil: yes i have checked the journal and i didnt found any errors there..it just told me that the EA is loaded and initialized...

any other idea?

TIP: better use "bool" instead of string for boolean variables "True" or "false".
First, the EA never open any trades for me on backtesting.
Second, Check the following if statement more deeply, its never true (Tested for one year back), thats why BUY and SELL are never true, and your orders are never opened.
I've added the Print line so you can see in the journal when this if is triggered.

Sorry I don't have much time to look deeper in the code. Good luck!

if(CurTime()-TimeEnd-900>=0 && CurTime()-TimeEnd-900<=SetMinutes*60 && Range>MinRangePips && Range<MaxRangePips)
      {
         BUY=true;
         SELL=true;
         Print("BUY AND SELL TRUE");
      }
 
@msbusinessil:
thanks for your kind reply..

1. Hmm..it's strange..i run that exact same EA from the attachment, and it works fine..Are you sure you were using the EA MALAM, not the BSL EA right? Were you using it on GBPUSD, 15m chart, on 4-digit broker? Was it producing any errors in the journal? I've run it again, and still, it works on mine..Hmm..what is wrong?

2. Thanks for the tips, i've changed it to 'bool' now..but the problem still the same..

3. Thanks for your "Print" tips. I've done it, and the journal shows something confusing for me:
a. In particular days, when the condition of range is met ( range < 70 pips), the journal shows me BUY AND SELL TRUE from time 16.30 to 16.34 (with SetMinutes set at 5 min). From my understanding, this shows that the IF STATEMENT was fulfilled and yes, i can see that on the backtest, there were pending orders properly opened that day (buy stop and sell stop at 16.30 time).
b. In some other days, when the condition of range is also met (range <70 pips), the journal doesnt show BUY AND SELL TRUE, which means that the IF STATEMENT was not fulfilled (which in this case, it should has, considering the range...), but the strange thing is that on these days, there were pending orders opened properly on 16.30 time. I mean, the journal doesnt show the BUY AND SELL TRUE, but the RESULTS Tab shows that there were pending orders opened that day.

4. Hmm.. i still dont get why the IF statemens will never true.. If we set TimeEnd to be 16:15, Set Minutes to be 5 min and CurTime is, say, 16.30 so the equation will be:
16:30 - 16:15 - 900second >=0 && 16:30 - 16:15 - 900second <= 5*60, thus
900s - 900s >=0 && 900s - 900s <= 300s, thus
TRUE && TRUE

so, please elaborate with me, sir..

thanks for your time..i really appreciate it, sorry for my english...i hope you understand what i meant....
 
It opens trades in the Strategy tester but not live!!! Mm...did you check the allow live trading box?
 
@farhang: yes sir, absolutely, i've checked it in the first place..any other idea sir?
 
is there something wrong with the way the code try to open the trade?it seems like there's really no effort in trying to make the trades..no errors on journals or expert tab..straange...
Reason: