I'm trying to code a strategy that uses the NBarsDown to specify N down days and then determines the percent loss over those days to execute an exit. I got the NBarsDown to work the way I want, but not sure how to get the percent loss over those days.Here is what I have.
if(Position.MarketPosition == MarketPosition.Long); double value = NBarsDown(DaysOfLoss, true, true, true)[0]; if (value == 1) //Print("Signal"); { if(Position.GetUnrealizedProfitLoss(PerformanceUni t.Percent, Close[0]) <= some%); { ExitLong("Exit", "Enter Long"); } } |
What is the best way to get the pecent loss over the specified days (I'm using DaysOfLoss as my parameter)? The GetUnrealizedProfitLoss is not working the way I expected. Is there a another/simper way to get this?
Thanks,
Lee
Comment