Want to have a trailing stop on each pair?

EAX_PIN_TRAILING_STOP is an indicator server PIN for use with the EAX Dashboard.
This indicator will trail the average profit of each pair using the selected Trailing Mode.

Example:

  1. You have 3 buy trades open on EURUSD, and you set a Trail mode of Points and an Offset of 100 (points), using pin 6 to signal the close.
  2. The Indicator will calculate the breakeven of the 3 trades and store this value in the Global Variable EURUSDpin6_Buy_BreakEven.
  3. Now, when the bid_price exceeds the BreakEven by the specified trail amount (100 points in this case) the Indicator will store the StopLoss price in the Global Variable EURUSDpin6_Buy_StopLoss. The stored price will continue to trail the increasing bid price.
  4. Finally, when the bid price falls below the Global StopLoss, pin 6 will be set to 2 (Sell). So if you set pin 6 in the dashboard to Exit on Opposite signal you can use this to close the trade.

Sell trades work in a similar manner using the Sell Global Variables and issuing a buy signal when the SL is crossed.

There are several Trailing Mode the play with.
Have fun.

PS. The indicator will try to detect any pair suffix (e.g. it will find the .m on EURUSD.m) , but you need to place it on a 6 character pair (i.e. the suffix will be detected on USDSGD.m, but not on GOLD.m, WTI.m, etc.)

v1.05 adds 3 new features:

  1. When using breakeven, you can now set Breakeven Offset & Breakeven Trigger levels. The PIN will not set a trail until the profit reaches the trigger level, at which point it will move the trail to the breakeven price plus the specified offset. From there, trailing will follow your configured mode and settings.
  2. For ATR mode, you can now set the ATR Ratio. E.g. 0.25 * Daily ATR.
  3. Finally, there is a setting called Keep TSL Values on change/unload. Previously the PIN would erase the global variables on exit, or when the settings were changed, meaning it would loose any existing trails. When this value is set to true, the PIN will not deliberately remove the global variables, so you can tweak the trailing mode without losing your stops. Note this will NOT work if you change the PIN #.

And there is an added bonus. This PIN is hell to test and hard to understand what it’s doing. So I have created a companion indicator.

v1.08. OK … so I think I have solved the bugs and I also made a few other changes. A quick summary:

Set Initial Stop-Loss: true=the pin will start trailing from the moment an order is opened, based on the Trailing Stop Mode. false=it will not set a trail until either the BE is triggered, or the profit is higher than the trial level. e.g. if the Trailing Stop Mode=Points and Trail Points=200, then the PIN will set an Initial Trail at BE-200 points.
Move to Breakeven: true=when the profit reaches the BE Trigger, the trail will move to the BE Lock. e.g. using the default values (BE Trigger 100, BE Lock 10) the PIN will wait until the trade is BE+100 points and then move the trail to BE+10 points.
Trail Points / Indicator Offset: If Trailing Stop Mode=Points, then this is simply the number of points it will trail by. If Trailing Stop Mode is an indicator, then then this will be added to the indicator value. E.g. if Trailing Stop Mode=ATR, Timeframe=1 day, ATR Ratio=0.5, Trail Points=50 then the trail distance is 0.5 * Daily ATR + 50 points.

Also, for PSAR and MA trails, it was possible to get some unexpected exits if the indicator was the ‘wrong side’ of the open price, e.g. if you opened a buy order below the MA, setting the SL to the MA makes no sense. If the PIN used the MA value it would immediately signal an exit. To avoid this I have coded the PIN to check the indicator position and, if necessary, flip the trailing distance to the other side of the price. E.g. If in MA mode and a buy was opened and the MA was 100 points above the open price, then the trail will be flipped and set 100 points below the open price.

v1.09 … fixed a bug in 1.08, not starting a trail if both Initial SL and Move to BE are false.

Download “JagzFX Trailing Stop PIN”

JagzFX_Trailing_Stop_PIN_v1_18.ex4 – Downloaded 425 times – 30.01 KB