Simple stop logic

#1
All - novice here and as usual getting half answers from amibroker tech support, back and forth, back and forth. Since the trailing stop they provided in 2013 apparently doesn't work in the new version, I asked them for simple profit target and static stop loss and they came back with;

ApplyStop( stopTypeProfit, stopModePoint, 6 * TickSize, 1 );
ApplyStop( stopTypeLoss, stopModePoint, 5 * TickSize, 1 );

Of course I get error because there is no 'sell' logic there...I remember somewhere, who knows where, something like stop=sell=...but I can't find it now. Can somebody knowledgeable just save me a bunch of work? This should backtest after this and I can stop hounding the world,

PB
 

ocil

Well-Known Member
#2
I am using below for stop loss and fix target:-
_SECTION_BEGIN("SL-TGT");
lastpriceBuy = ValueWhen(Buy, Close);
lastpriceSell = ValueWhen(Sell, Close);
Profit = Optimize("Profit",3, 200,1600,200);
Loss = Optimize("Loss", 1.5, 100,1000,100);
ApplyStop(stopTypeProfit, stopModePoint, Profit);
ApplyStop(stopTypeLoss, stopModePoint, Loss);
_SECTION_END();
 

trash

Well-Known Member
#3
All - novice here and as usual getting half answers from amibroker tech support, back and forth, back and forth. Since the trailing stop they provided in 2013 apparently doesn't work in the new version, I asked them for simple profit target and static stop loss and they came back with;

ApplyStop( stopTypeProfit, stopModePoint, 6 * TickSize, 1 );
ApplyStop( stopTypeLoss, stopModePoint, 5 * TickSize, 1 );

Of course I get error because there is no 'sell' logic there...I remember somewhere, who knows where, something like stop=sell=...but I can't find it now. Can somebody knowledgeable just save me a bunch of work? This should backtest after this and I can stop hounding the world,

PB
Your assumption is completely wrong and misleading. Trailing stop works perfectly fine.
Also trailing stop has not been provided 2013 but many years earlier.

Stops can be created either by using

1. ApplyStop function
2. Looping

If using Applystop then you need to take care that you do not miss adding SELL or COVER variable! If you do NOT want to add additional sell/cover regular signal based exits as aside from using applystop then you have to set Sell/ Cover variable to zero!

What has made you think that Sell/Cover variables are not required just because of using ApplyStop? It is no where recommended on official sites.

There are even several examples of knowledge base articles using ApplyStop http://www.amibroker.com/kb/index.php?s=applystop
Also you should check out and try to UNDERSTAND function reference of ApplyStop http://www.amibroker.com/guide/afl/applystop.html
 
#4
Thank you for the help but I am confused. I must admit I have many skills but I cannot wrap my head around programming language. Bear with me please. What seems simple and intuitive to you is not for me. The examples I see referenced seem different from what I am trying to do.

So do I need some line of code like:
Sell=0
Sell = 1
??

All the answers I get including from Amibroker support are very incomplete and they are making many assumptions themselves. They are the pros; I am not. Thank you,

PoBoy
 

Similar threads