Hi PRC Team,
I want to measure my target profit from the highest high or lowest low as measured after the trade and not from the entry price. I tried the following but it did not work:
If (highest[barindex - tradeindex](high)) - close >= 50 Then
Exitshort at market
Endif
If close - (lowest[barindex - tradeindex](low)) >= 50 Then
Sell at market
Endif
CLOSE moves every bar, so it can’t work!
You’ll have to replace CLOSE with TradePrice to make it work.
Moreover, you may happen to be reported an error because HIGHEST and LOWEST may have 0 as a lookback number.
I suggest that you replace the above code with:
If ShortOnMarket AND (highest[max(1,barindex - tradeindex)](high)) - close >= 50 Then
Exitshort at market
Endif
If LongOnMarket AND close - (lowest[max(1,barindex - tradeindex)](low)) >= 50 Then
Sell at market
Endif
Thanks Robertogozzi,
I will try and see how it will work, I also thought I can try the following:
If Longonmarket and Close>=(Lowest[Barindex-TradeIndex](Low) +5 0) Then
Sell at Market
Endif
If Shortonmarket and Close <= (Highest[Barindex-TradeIndex](High) - 50) Then
Exitshort at Market
EndIf