Hello forum,
I’m new at this with no coding experience, I’m trying to sort out the code for the simple logic below. Could someone help with this?
- Is close of the candle for a 30m or 15min period above or below open
- If above, then place a buy order for x amount with a specific SL and Limit
- If below, then place a sell order for x amount with a specific SL and Limit
Much appreciated!
Regards,
Pablo.
pablojml – Your question is strategy related. The place for strategy questions is the ProOrder forum and not the PrScreener forum. I will move your post to the correct forum.
Please post in the correct forum with future posts.
There you go:
Offfset = 20 * pipsize
IF close > open THEN
BUY 1 CONTRACT AT close + Offset STOP
ELSIF close < open THEN
SELLSHORT 1 CONTRACT AT close - Offset STOP
ENDIF
SET TARGET PPROFITO 50
SET STOP PLOSS 50
Thanks Roberto,
I’m struggling to understand what the offset does in this code. And what is the difference between these two:
Buy 1 CONTRACTS AT MARKET
Buy 1 CONTRACTS AT close
If the code is testing if opening is above or below close, then “AT MARKET” should do the trick no? as it will be comparing precisely at close and buying/selling at the start of the next candle.
Also, forgot to add if I wanted to test 1 specific candle of the day at one specific hour, how can I add this to the code?
Regards,
Pablo.
Offset is what you meant by X, a displacement or distance from the price.
Otherwise what amount was your X?
As for the time:
IF time = 090000 THEN
.
. //here you need to put all the code you want to be executed at the desired time
.
ENDIF