I cant find the code for a simple currency trailing stop loss.
I currently have this:
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CrossAbove(Low, sma, 1) && High[2] < sma.Value[2])
EnterLong(coinAmount);
if (Position.MarketPosition == MarketPosition.Long)
{
if (CrossBelow(High, sma, 1))
ExitLong(coinAmount);
}
if (CrossBelow(High, sma, 1) && Low[1] < sma.Value[1])
{
EnterShort(coinAmount);
}
if (Position.MarketPosition == MarketPosition.Short)
{
if (CrossBelow(Low, sma, 1))
ExitShort(coinAmount);
}
}
but I want to trail the current price by 20$ and cant find how to do that?
Comment