HellO Experts,
I am new to Amibroker, I have learnt a lot from you all. I would like to thank you all for your help and support.
I have one difficulty in coding the exit system in my AFL.. I kindly request everone of you here to try to fix me this. Let me post the code where I struggle..
Exitbuy = Ref( High, -1 ) == exitbu;
Exitsell = Ref( Low , -1 ) == exitse;
BUY = Buycondition AND timeOK;
Sell = Sellcondition AND timeOK;
Cover = Exitsell AND timeOK;
Short = Exitbuy AND timeOK;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Cover = ExRem(Cover,Short);
Short = ExRem(Short,Cover);
Exitbuy = ExRem(Exitbuy,Exitsell);
Exitsell = ExRem(Exitsell,Exitbuy);
In the above code, I get perfect entry signals (Buy and Sell) and everything works fine... But for exit singals (Cover and Short) I get it even if I dont have entry signals...
I would like to get exit signal of Buy (Short) only if the previous signal is Buy and exit signal of Sell (Cover) only if the previous signal is Sell. I dont want Cover signal (Exit for sell) for buy entry and vice versa.
NOTE: Its beccause the exit signal condition is met at many places. I want it to generate signals only if there is buy or sell signal.
I hope, I have explained it properly.. Please somebody help me... Thanks...
I am new to Amibroker, I have learnt a lot from you all. I would like to thank you all for your help and support.
I have one difficulty in coding the exit system in my AFL.. I kindly request everone of you here to try to fix me this. Let me post the code where I struggle..
Exitbuy = Ref( High, -1 ) == exitbu;
Exitsell = Ref( Low , -1 ) == exitse;
BUY = Buycondition AND timeOK;
Sell = Sellcondition AND timeOK;
Cover = Exitsell AND timeOK;
Short = Exitbuy AND timeOK;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Cover = ExRem(Cover,Short);
Short = ExRem(Short,Cover);
Exitbuy = ExRem(Exitbuy,Exitsell);
Exitsell = ExRem(Exitsell,Exitbuy);
In the above code, I get perfect entry signals (Buy and Sell) and everything works fine... But for exit singals (Cover and Short) I get it even if I dont have entry signals...
I would like to get exit signal of Buy (Short) only if the previous signal is Buy and exit signal of Sell (Cover) only if the previous signal is Sell. I dont want Cover signal (Exit for sell) for buy entry and vice versa.
NOTE: Its beccause the exit signal condition is met at many places. I want it to generate signals only if there is buy or sell signal.
I hope, I have explained it properly.. Please somebody help me... Thanks...
Attachments
-
88.5 KB Views: 316