Simple Coding Help - No Promise.

Can you confirm that in above code triggers are as per what you wanted?
Sir i checked it and found that it works sometimes and sometimes it doesnt.



Plz see that the buy should have been triggerd at 840.8 but it didnot.. but the earlier buy at 1130 was triggered successfully.

Is there something that i have to do to setup my database correctly for the code.

Really appreciate your help.

Thanks
 
Means you want the signal to come on 5min after the 15bar is complete at which crossover happens?
What he probably means is when and as long as 15 min is in buy mode, the AFL should show only buy signals on the 5 min chart and vice versa ie when and as long as 15 min is in sell mode, all sell signals on 5 min should be shown ignoring buy signals in this phase.

ST
 
What he probably means is when and as long as 15 min is in buy mode, the AFL should show only buy signals on the 5 min chart and vice versa ie when and as long as 15 min is in sell mode, all sell signals on 5 min should be shown ignoring buy signals in this phase.

ST
absolutely right st sir..
 
Code:
timeframeset(in1minute*15);
ema3 = ema(c, 3);
ema15 = ema(c, 15);
ema3e = timeframeexpand(ema3, in1minute*5);
ema15e = timeframeexpand(ema15, in1minute*5);
timeframerestore();

buy = ema3>ema15 and cross(ema(c, 3), ema(c, 15));
sell = ema3<ema15 and cross(ema(c, 15), ema(c, 3));
Not tested but should do the job.
thank u for ur help. i tried this before but almost all signals are repainting and there is error in backtesting also..
 

pratapvb

Well-Known Member
Sir i checked it and found that it works sometimes and sometimes it doesnt.



Plz see that the buy should have been triggerd at 840.8 but it didnot.. but the earlier buy at 1130 was triggered successfully.

Is there something that i have to do to setup my database correctly for the code.

Really appreciate your help.

Thanks
The hourly bar has to complete. That means the next bar as to start atleast a tick for the signal to show. Else you will have to live with repaint as the bar keeps changing
 

pratapvb

Well-Known Member
thank u for ur help. i tried this before but almost all signals are repainting and there is error in backtesting also..
That is why I asked whether one should wait for 15 min bar complete before confirming the signal
 

pratapvb

Well-Known Member
But sir in this image hourly bar got completed.. but the trade didnt trigger:confused::confused::confused:
i saw the next bar.. the trade didnt trigger at 1230
I think 1 more tick is required. If you are doing bar replay with 1min step can you do 1more step and see?
 
I think 1 more tick is required. If you are doing bar replay with 1min step can you do 1more step and see?
yes sir i tried it but it didnt trigger..
plz see the image for yourself.



The trade should have triggered on 5 min tf at 1230 as all conditions were fulfilled.. but it didnot. Plz resolve.

Thanks so much for ur time.
 

Similar threads