I am trying to write a pro-order strategy code, based around the inside bar.
I have looked online to try and help, but the assisted creation only seems to be able to get me so far, I can’t seem to progress any further. I have looked through previous strategies, but they are not helping.
Here goes…
For the inside bar to be valid, it must include the extreme wicks, so it is completely inside the previous candle.
Hourly chart, DOW.
No trades on Saturday or Sunday.
No time restrictions.
If an inside bar occurs, the strategy looks for certain conditions, to take, or not take, the trades.
Condition 1; if the price close at 23:00 today, is higher than the price close at 23.00 yesterday, then only a long position can be taken, off the inside bar.
Condition 2: if the price close at 23:00 today, is lower than the price close at 23.00 yesterday, then only a short position can be taken, off the inside bar.
Stop: 5 pips higher/lower, than the inside bar low/high including the wicks.
Target: Size of the inside bar, (including high/low wicks).
I have attached a chart as an example.
I don’t mind having a go with the code, if people give hints.
Indicator1 was my screener, that show yellow or blue candles, when it is an inside bar.
DEFPARAM CumulateOrders = False
n = 1
REM Définition du Harami
c1= high[0] < high[1]
c2= low[0] > low[1]
harami = c1 and c2
CALL "INSIDE BAR"
c1 = (close > indicator1)
IF c1 THEN
BUY 1 PERPOINT AT MARKET
ENDIF
tcondition = time>230000 and time<000000
IF harami and close < open and not daysforbiddenentry THEN
buy n shares at market nextbaropen
ENDIF
IF harami and close > open and not daysforbiddenentry THEN
sellshort n shares at market nextbaropen
ENDIF
// Clôture
IF barindex - tradeindex = 1 THEN
sell at market
exitshort at market
ENDIF
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0