I have moved the development topic here- Feel free to join the development and cast your ideas here. To begin with I have made a short only version. It’s still not profitable if run on tick by tick backtest.
Original indicator topic is here.
AbzParticipant
Veteran
hello
what are i doing wrong here? my goal is as following
- upper is the highest price between 080000 and 090000
- enter short when price goes under “upper”
- next bar also close under upper and i also want to be sure that this bar high is also under “upper”
- target and profitt is the amount of points between upper and lower
DEFPARAM CumulateOrders = false // Cumulating positions
DEFPARAM PRELOADBARS = 1000
DEFPARAM FLATAFTER = 220000
IF Time = 080000 THEN
TradeCounter = 0
ENDIF
// Trading Hours
IF (Time >= 090000 AND Time <= t1) and dayofweek<=5 then// or (Time >= 220000 AND Time <= 220100) and dayofweek=1 THEN //
Tradetime=1
else
Tradetime=0
endif
t1=220000
//Settings
once upper=0
once lower=0
// calculate upper and lower
endtime = 090000
If Time = endtime then
upper=highest[12](high)
lower=lowest[12](low)
dif=round(abs((lower-upper)*pipsize*pointvalue))
endif
//looking for short position
entershort1 = close[1] > upper
entershort2 = close crosses under upper
entershort3 = close < upper
if not onmarket and entershort1 and entershort2 and entershort3 then
fadeshort=1
elsif onmarket then
fadeshort=0
endif
if not onmarket and tradecounter < 1 and tradetime and fadeshort then
sellshort 5 contracts at market
TradeCounter = TradeCounter + 1
endif
set stop loss dif
set target profit dif
There is something wrong with this code. It’s not behaving as expected. I need to take a look.
Cheers Kasper
AbzParticipant
Veteran
if you coud help me to add long as well it woud be great.
AbzParticipant
Veteran
hello Casper
have you been able to look at this code?
yes I have, and I was not able to get any positive results on a automated strategy. I Will devote my time to other projects as this has taken huge amount of my spare time only to be caught in the optimization process and zero bar trading.
I tried a buy signal with low < lower which seems to work, limited to 0900-0915 am.
Then, either sell at high > upper or limit or trailing stop, depending on your preferences.
Seems solid with walk forward also.
Best regards, David
@dajvop You should share your modified code to encourage our friend Kasper! 🙂 I feel like he needs our support! Cheers Kasper 🙂
Sure, just bear in mind that it is pretty simple 🙂
Hejsan Dajvop.
Thanks for sharing you development. Initially it looks good- it has a profit. However the stop loss at 1.5% of the average tradeprice would yield somewhat in the neighbourhood of 180 points. If we take a look at the average gain it’s an RR of 0.1. that’s not good. I tried to optimize your code with a lower plain stoploss, but I could not come up with something more sustainable number. My own testing was trying to trade max 2 trades a day 9:00-17:00 and inside the initial balance if below 40 pips and above 40 pips as a breakout strategy. however I never liked the results, so I stopped the testing.
Cheers Kasper