Hi I am new to coding and just started learning. I was hoping someone could help me with a simple code to help me learn how it is structured.
Two orders placed on the FTSE after the first 15 minute candle is formed at the open.
One long order + 1 point above the high of the 15 minute candle.
One Short order -1 point below the low of the 15 minute candle.
£3 per point on both
Once one order is triggered the other order is deleted.
Limit 45 points
Stop 20 points
After the price has moved 25 points stop loss moves to breakeven/ open price.
If any one could help me with this it would be much appreciated.
Thank you in advance.
Chris
Your title was not meaningful (“assistance for a code..”), it doesn’t help people to find relevant topic in the future. Please respect the posting rules detailed below in the yellow box.
Sorry I’m new I will make sure I make the title relevant in the future.
There you go:
DEFPARAM CumulateOrders = true
ONCE LongEntry = 0
ONCE ShortEntry = 0
IF Not OnMarket THEN
MyProfit = 0
ENDIF
IF Time = 090000 THEN //must be set to the TIME the first 15-minute candle candle closes
LongEntry = high + 1*PipSize
ShortEntry = low - 1*PipSize
ENDIF
IF LongTriggered OR ShortTriggered THEN
LongEntry = 0
ShortEntry = 0
ENDIF
IF LongEntry > 0 THEN
BUY 3 Contract AT high + 1*PipSize STOP
SET TARGET pPROFIT 45
SET STOP pLOSS 20
ENDIF
IF ShortEntry > 0 THEN
SELLSHORT 3 Contract AT low - 1*PipSize STOP
SET TARGET pPROFIT 45
SET STOP pLOSS 20
ENDIF
IF OnMarket AND MyProfit < 25 THEN
MyProfit = PositionPrice * PositionPerf / PipSize
IF MyProfit >= 25 THEN
Set Stop Breakeven
ENDIF
ENDIF
Roberto your a star thank you ever so much.