Development of initial ballance automated strategy
Forums › ProRealTime English forum › General trading discussions › Development of initial ballance automated strategy
- This topic has 9 replies, 4 voices, and was last updated 7 years ago by Elsborgtrading.
-
-
03/28/2017 at 6:04 PM #3017603/28/2017 at 7:41 PM #30180
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
12345678910111213141516171819202122232425262728293031323334353637383940414243444546DEFPARAM CumulateOrders = false // Cumulating positionsDEFPARAM PRELOADBARS = 1000DEFPARAM FLATAFTER = 220000IF Time = 080000 THENTradeCounter = 0ENDIF// Trading HoursIF (Time >= 090000 AND Time <= t1) and dayofweek<=5 then// or (Time >= 220000 AND Time <= 220100) and dayofweek=1 THEN //Tradetime=1elseTradetime=0endift1=220000//Settingsonce upper=0once lower=0// calculate upper and lowerendtime = 090000If Time = endtime thenupper=highest[12](high)lower=lowest[12](low)dif=round(abs((lower-upper)*pipsize*pointvalue))endif//looking for short positionentershort1 = close[1] > upperentershort2 = close crosses under upperentershort3 = close < upperif not onmarket and entershort1 and entershort2 and entershort3 thenfadeshort=1elsif onmarket thenfadeshort=0endifif not onmarket and tradecounter < 1 and tradetime and fadeshort thensellshort 5 contracts at marketTradeCounter = TradeCounter + 1endifset stop loss difset target profit dif03/28/2017 at 9:04 PM #30182There is something wrong with this code. It’s not behaving as expected. I need to take a look.
Cheers Kasper
1 user thanked author for this post.
03/28/2017 at 9:52 PM #3018404/04/2017 at 8:25 PM #3103504/05/2017 at 8:22 AM #31067yes 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.
04/13/2017 at 2:19 PM #31952I 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
04/13/2017 at 2:28 PM #3195404/13/2017 at 2:43 PM #3195804/16/2017 at 2:38 PM #32186Hejsan 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
-
AuthorPosts
Find exclusive trading pro-tools on