Page 1 of 1

Moving stop loss to x pips away from previous HA bar

PostPosted: Fri Mar 03, 2017 4:41 pm
by nanobyt3
Hi all, :)

I have been developing a strategy in lua for FXCM Trading Station and I'm having problems moving a stop loss to few pips (customizable) away from a previous HeikenAshi bar. I have the following:

Code: Select all
   --Trailing the SL to x PBT pips from the previous bar
   if haveTrades("B") then
         valuemap.PegTypeStop = "O";
         valuemap.PegPriceOffsetPipsStop = iHA.low[period]-PBT;
         core.host:trace("Moving Stop Loss Higher to ".. tostring(iHA.low[period]-PBT));
      end


PBT is the variable with the number of PIPs away from the low as in this case. the log shows me big number when trying to add the iHA.low[period]+PBT. This number does not seem to be related to price.

Any good link for me to learn how to move the Stop Loss to whatever position I need?

Thank you very much

Re: Moving stop loss to x pips away from previous HA bar

PostPosted: Sat Apr 25, 2020 7:20 pm
by rog9912345
Did you manage to solve this? I'm trying to do something similar-ish (no success here yet).

Re: Moving stop loss to x pips away from previous HA bar

PostPosted: Sun Apr 26, 2020 6:16 am
by Apprentice
Your request is added to the development list.
Development reference 1147.

Re: Moving stop loss to x pips away from previous HA bar

PostPosted: Tue Apr 28, 2020 10:19 am
by Apprentice
if side == "B" then
valuemap.RateStop = iHA.low[period] - PBT * iHA.lowpipSize();
else
valuemap.RateStop = iHA.high[period] + PBT * iHA.lowpipSize();
end

Re: Moving stop loss to x pips away from previous HA bar

PostPosted: Tue May 19, 2020 10:14 pm
by dab13fx
does by any chance you guys know one that i will move every 1 HR candle for example


thanks

Re: Moving stop loss to x pips away from previous HA bar

PostPosted: Mon May 25, 2020 6:27 am
by Apprentice
Your request is added to the development list.
Development reference 1352.

Re: Moving stop loss to x pips away from previous HA bar

PostPosted: Mon May 25, 2020 7:01 am
by Apprentice
Code: Select all
function Prepare()
    Source = ExtSubscribe(2, nil, TF, instance.parameters.Type == "Bid", "bar");
end
function ExtUpdate(id, source, period)
    if id == 2 then
        --move stop
    end
end