I'm a newbie in programming. I'm currently working on automating a strategy. I'm stuck on the trailing stop part of it.
I do not have a hard profit target, but what I do have is a trailing stop being placed, when a certain condition occurs.
Here is my code snippet:
if ((Position.MarketPosition == MarketPosition.Long)
&&(CrossBelow(Stochastics(BarsArray[1],3, 5, 2).K, 65, 1))
&&(Falling(Stochastics(BarsArray[2],3, 5, 2).K) == true))
{
BarColor = Color.Gold;
SetStopLoss(CalculationMode.Price, Low[0] - 5 * TickSize);
}
It basically paints a candle a certain color(simply for visual aid, while i'm working on the strategy) and places a stop loss 5 ticks under the low. However, I want the stop loss to move up with each candle after it has been placed. What currently happens, the stop gets placed and just sits there until the next similar condition occurs in the trend. Only then it moves. Does anyone have any ideas on how i can make it move up with each candle?
Comment