Australian (ASX) Stock Market Forum

AmiBroker Plugin for Trailing Stop Plots

To use these indicators, create new indicators with appropriate names and load the supplied code into them.

I don't understand. The ATR trailing stop plot is to close a trade (as in formula backtest) not an indicator. :confused:
 
Haven't had a chance to mess with the stop plot yet but I imagine it will involve putting the dll file in the amibroker plugin folder and in the formula editor loading the .afl indicator from the zip file you want. Then applying the indicator.
For riding a trend I would use the ATR trailing stop later as the trend matures or in other words not from trade open. Much prefer to use S/R levels initially to avoid missing a good chunk of the trend and/or choosing to re-enter.
As an alternative, setting the ATR multiplier to 5 will keep the trade alive longer and tightening up the multiplier to 2 as the trend matures, profit contentment reached or exchange action changes. All pending risk appetite of course.

ATR with 2.5 multiplier in this chart.
 

Attachments

  • untitled.jpg
    untitled.jpg
    48 KB · Views: 50
Hi all,

New to Amibroker and trying to replicate GP's plugin results. I am close but hoping someone can save me a bit of time....

Not sure how to get the 'buy' arrow on the buy date. I think I have the sell sorted.

Cheers

Here is my indicator code...
stopArray = GP_CreateStop(Close - 2.5*ATR(15), Name(), 1, -1);
Buy = GP_GetBuyDate(Name(), 1);
Sell = Close < Ref(stopArray , -1);

Plot (stopArray, "ATR Stop Loss", colorBlue, styleLine | styleThick | styleDots);

PlotShapes(IIf(Buy = Now(3) , shapeUpTriangle, shapeNone), colorBlue, 0, Low, -30);
PlotShapes(IIf(Sell, shapeDownTriangle, shapeNone), colorOrange, 0, Low, 30);

Here is my current chart results....
ABC_Example.JPG
 
Does anyone have GP's Short version of the trailing stop. I've got the original one working fine but also want one to use for short trades?

Thanks,
Matt
 
Does anyone have GP's Short version of the trailing stop. I've got the original one working fine but also want one to use for short trades?

Thanks,
Matt
1 - right click on the chart that has the GP Plot (can drag plot onto chart).
2 - left click on"parameters" at the top of the window that opened.
3 - the "parameters" window opens and see at number 4. Short = 0, Long = 1?
4 - left click the space alongside 4. Short = 0, Long = 1? and a slider will appear.
5 - slide it to 0 for Short.

You're welcome and leave the money on the fridge. :D
 
1 - right click on the chart that has the GP Plot (can drag plot onto chart).
2 - left click on"parameters" at the top of the window that opened.
3 - the "parameters" window opens and see at number 4. Short = 0, Long = 1?
4 - left click the space alongside 4. Short = 0, Long = 1? and a slider will appear.
5 - slide it to 0 for Short.

You're welcome and leave the money on the fridge. :D

This is how mine looks! What do I do to make it go short?

trail stop example.png
 
This is how mine looks! What do I do to make it go short?

View attachment 41784
These are the seven parameters poster Great Pig had in his original code. You don't have #4 which is "isLong"

PHP:
pfId = Param("1. Portfolio Number?", -1, -1, 255, 1);
mul = Param("2. Multiplier?", 3, 0.1, 10, 0.1);
period = Param("3. Period?", 14, 1, 100, 1);
isLong = Param("4. Short=0, Long=1?", 1, 0, 1, 1) != 0;
doSl = Param("5. Plot as Stop/Loss?", 1, 0, 1, 1);
barr = Param("6. Start array (0=L/H, 1=C)?", 1, 0, 1, 1);
earr = Param("7. Sell array (0=L/H, 1=C)?", 1, 0, 1, 1);
 
These are the seven parameters poster Great Pig had in his original code. You don't have #4 which is "isLong"

PHP:
pfId = Param("1. Portfolio Number?", -1, -1, 255, 1);
mul = Param("2. Multiplier?", 3, 0.1, 10, 0.1);
period = Param("3. Period?", 14, 1, 100, 1);
isLong = Param("4. Short=0, Long=1?", 1, 0, 1, 1) != 0;
doSl = Param("5. Plot as Stop/Loss?", 1, 0, 1, 1);
barr = Param("6. Start array (0=L/H, 1=C)?", 1, 0, 1, 1);
earr = Param("7. Sell array (0=L/H, 1=C)?", 1, 0, 1, 1);


Ok that makes sense. I made the changes in the formula and it now shows up in parameters. I clicked on the graph again however and it is still only going long. It doesn't seem to matter whether I select 0 or 1. Any thoughts?

trail stop example.png
 
Hi all, I found this plugin very interesting and useful, but I can not get this plugin installed, I am using Amibroker 5.4 64bit, and copied the file "GP_Stops.dll" into the AmiBroker "Plugins" folder, but after I start Amibroker, this plugin is not loaded when looking at "Tools->Plug-ins". Is it the 64bit version casing the problem?
 
Is it the 64bit version casing the problem?

Yeh, 32 bit plugins wont work with 64 bit Amibroker.

http://www.amibroker.com/x64/

[FONT=Arial, Helvetica, sans-serif]Limitations:[/FONT]

  • [FONT=Arial, Helvetica, sans-serif]old 32 bit plugins do not work with 64 bit applications[/FONT]
Not sure if GP is still around but you may be able to recompile the plugin for 64 bit application if GP wants to release the source code.
 
Ok that makes sense. I made the changes in the formula and it now shows up in parameters. I clicked on the graph again however and it is still only going long. It doesn't seem to matter whether I select 0 or 1. Any thoughts?
Sorry pav for no reply. I dropped out of the game back then. Have gone 64 bit and cannot use any 32 bit Amibroker direct link library nor know how to change them to 64 bit. :frown:

Yeh, 32 bit plugins wont work with 64 bit Amibroker.

Not sure if GP is still around but you may be able to recompile the plugin for 64 bit application if GP wants to release the source code.
I have been looking but I found out I don't know where to look. From information I have gathered I think the .dll has to be decompiled but from there I don't know the format/runtime/.NET or whatever has to be changed.

The code might be able to be reproduced in native AFL?
 
I want to convert this plugin to 64bit. Any objections please lodge them now including the original author.
Thanks.
 
Yes I am sure it possibly could be done in native AFL but it isn't like that wise stock trader one. The long trailer stays either long or short and doesn't swing over.
 
Yes I am sure it possibly could be done in native AFL but it isn't like that wise stock trader one. The long trailer stays either long or short and doesn't swing over.

I have not checked that plugin but do you mean like so?
If you have a short signal then you have short trail stop being active,
if you have long signal then there is long trail stop being active.

Tc1MsAz.gif
 
The authors original intent and I like it was to click on the chart a trade entry bar to start the trailing stop(s). The trail for long, short, multiplier, range etc. is set in Parameters window. The trail stays whatever the setting as in these chart shots and doesn't switch long to short or turn down for long or up for short.

syb_gp1-gif.2218
 
The authors original intent and I like it was to click on the chart a trade entry bar to start the trailing stop(s). The trail for long, short, multiplier, range etc. is set in Parameters window. The trail stays whatever the setting as in these chart shots and doesn't switch long to short or turn down for long or up for short.

Storing "date == date_of_chart_click" is just one of any other entry sig condition (so you always have just one entry signal). So there isn't any giant miracle about it. The only other thing I added is option to continue drawing line after first break of stop line (as seen in your picture).

http://www.fastswf.com/XCGYGHc

5XGVIeQ.gif
 
Last edited by a moderator:
Top