JanParticipant
Veteran
Hi all,
could not find the answer here around, that’s why I made a new topic :
If close > close[1] then
BUY 3 shares AT Lowest[5](low) limit
endif
The command BUY 3 shares AT Lowest[5](low) limit : gives a limit buy order each time a bar close, defined as the minimum/lowest value of the last 5 closed bars;
as long as the condition close > close[1] is true, the minimum value is recalculated after each bar close.
Two questions:
- can the inital limit order be valid for more than one bar ? If yes, what is the PRT-code?
- can the initial minimal value be fixed in the code (not being recalculated after a bar) ? If yes, how to code it in PRT ? (with help of barindex – tradeindex or ??)
Thanks in advance for your help !
Kind regards, Jan
1 – No, pending Limit/Stop orders expire after one bar and need to be placed again and again as conditions are still met
2 – You need to save that value and not let it be recalculated each new candle (but you will have to, sooner or later, recalculate it, maybe after some bars or at the beginning of a new day)
ONCE EntryPrice = 0
IF close > close[1] AND EntryPrice = 0 THEN
EntryPrice = Lowest[5](low)
ENDIF
BUY 3 shares AT EntryPrice limit
JanParticipant
Veteran
Using limit orders for more than one bar is also clearly described at the PRT Trading programming Help manual, https://www.prorealtime.com/en/pdf/probacktest.pdf at page 11.