Hi there,
I am a new ProRealTime user and just working my way through the programming manual in order to get to grips with the programming language!
It would be ever so helpful if someone could tell me the correct code for the following – they are simple instructions, but it will just help with my understanding of how very basic coding works:
1.) If price increases for 2 consecutive trading days, buy on the next day’s open and hold for 2 full days, then sell.
2.) If current day’s close price is 2% above previous day’s close price, buy.
If someone would be kind enough to tell me the code for the above lines, it would help me with a couple of areas of coding I’m stuck on!
Many thanks,
Rob
As for question 1):
Defparam cumulateorders = false
IF (BarIndex - TradeIndex) = 2 THEN //After 2 bars close trade
SELL AT MARKET
ENDIF
IF close > open AND close > close[1] AND close[1] > close[2] THEN //3 consecutively rising bars
BUY 1 CONTRACT AT MARKET
ENDIF
As for question 2):
Defparam cumulateorders = false
PriceDiff = close - close[1] //difference in Price
IF close > close[1] AND PriceDiff >= (close[1] * 0.02) THEN //Trade only if current price is greater than 2%
BUY 1 CONTRACT AT MARKET
ENDIF
I think they should do!
Many thanks Roberto! That’s helped me a great deal!!
All the very best,
Rob