gbp/jpy profitable strategy help
Forums › ProRealTime English forum › ProOrder support › gbp/jpy profitable strategy help
- This topic has 8 replies, 2 voices, and was last updated 5 years ago by
abro163.
-
-
11/09/2020 at 12:14 PM #149895
Hi I tried to code this strategy https://www.youtube.com/watch?v=PaVIbaTRO7o
I seem to have succesfully done that, but the profit factor is not as good as he claims. It is a “stop and reverse” type strategy
One thing I noticed was that if the profit target was hit, the strategy reenters the position – How can I stop it entering when the stop or profit target is hit. (you can see on 18mar 2020)
I tried to play around with a tradecount below, but not sure. Went into an infinite loop or missed the next trade on 19mar 2020
Set chart to newyork time !
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950// code-parameterDEFPARAM CumulateOrders = false// window high/low calculationONCE StartTime = 000000ONCE EndTime = 040000// trading windowONCE BuyTime = 040000ONCE SellTime = 150000sl = 150tp = 470// calculate high/low and sl/tpIF Time >= StartTime AND Time <= EndTime THENIF TIME = StartTime THENDailyHigh = HighDailyLow = LowENDIFIF High > DailyHigh THENDailyHigh = HighENDIFIF Low < DailyLow THENDailyLow = LowENDIFTradeCounterLong = 0TradeCounterShort = 0ENDIF// position managementIF Time >= BuyTime AND Time <= SellTime then//and tradecounterlong <=1 THENbuy 1 contract at dailyhigh stopTradeCounterLong = TradeCounterLong + 1SET STOP pLOSS slset target pprofit tpENDIFIF Time >= BuyTime AND Time <= SellTime then //and TradeCounterShort <=1 THENsellshort 1 contract at dailylow stopTradeCounterShort = TradeCounterShort + 1SET STOP pLOSS slset target pprofit tpENDIF11/09/2020 at 12:52 PM #149898Add this at line 6:
1ONCE TradeON = 1add this at lines 40 and 49:
1TradeON = 0add this at line 13:
123If IntraDayBarIndex = 0 THENTradeON = 1ENDIFthen add this condition at lines 34 and 43:
1AND TradeON = 111/10/2020 at 8:39 AM #149980Thanks Roberto, I tried your code but it made the system trade only once per day. It is stop and reverse so can trade twice
I want it not to trade after the stop or profit target gets hit for the remaining time in the day,
I tried to make it like your example with two variables – tradeonShort and tradeonLong ,
So only one long trade and one short per day is taken, which should work, but didn’t seem to work.
11/10/2020 at 10:01 AM #14999711/10/2020 at 12:58 PM #150022This should do, it only allows one LONG and one SHORT trade per day:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758// code-parameterDEFPARAM CumulateOrders = false// window high/low calculationONCE StartTime = 000000ONCE EndTime = 040000// trading windowONCE BuyTime = 040000ONCE SellTime = 150000ONCE TradeLONG = 0ONCE TradeSHORT = 0IF IntraDayBarIndex = 0 THENTradeLONG = 0TradeSHORT = 0ENDIFsl = 150tp = 470// calculate high/low and sl/tpIF Time >= StartTime AND Time <= EndTime THENIF TIME = StartTime THENDailyHigh = HighDailyLow = LowENDIFIF High > DailyHigh THENDailyHigh = HighENDIFIF Low < DailyLow THENDailyLow = LowENDIFTradeCounterLong = 0TradeCounterShort = 0ENDIF// position managementIF Time >= BuyTime AND Time <= SellTime and not LongOnMarket and TradeLONG = 0 then//and tradecounterlong <=1 THENbuy 1 contract at dailyhigh stopTradeCounterLong = TradeCounterLong + 1SET STOP pLOSS slset target pprofit tpTradeLONG = 1ENDIFIF Time >= BuyTime AND Time <= SellTime and not ShortOnMarket and TradeSHORT = 0 then //and TradeCounterShort <=1 THENsellshort 1 contract at dailylow stopTradeCounterShort = TradeCounterShort + 1SET STOP pLOSS slset target pprofit tpTradeSHORT = 1ENDIF11/12/2020 at 1:04 PM #150274Thanks, that didn’t really work either,
I got it
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859// Open Range Breakout DAX 5/15M// code-parameterDEFPARAM CumulateOrders = false// window high/low calculationONCE StartTime = 000000 //000000ONCE EndTime = 040000 //040000// trading windowONCE BuyTime = 040000 //040000ONCE SellTime = 150000 //150000sl = 150tp = 470// calculate high/low and sl/tpIF Time >= StartTime AND Time <= EndTime THENIF TIME = StartTime THENDailyHigh = HighDailyLow = LowENDIFIF High > DailyHigh THENDailyHigh = HighENDIFIF Low < DailyLow THENDailyLow = LowENDIFtradeCounterLong = 0TradeCounterShort = 0ENDIF// position managementIF Time >= BuyTime AND Time <= SellTime and tradecounterlong <=2 and close>close[1] then //and tradecounterlong <=1// Long and currentdayofweek <5 and DClose(0)>DClose(1)buy 1 contract at dailyhigh stopTradeCounterLong = TradeCounterLong + 1SET STOP pLOSS slset target pprofit tpENDIFIF Time >= BuyTime AND Time <= SellTime and tradecountershort <=2 and close<close[1] then// Long and currentdayofweek <5 and DClose(0)>DClose(1) and tradecountershort <=1sellshort 1 contract at dailylow stopTradeCounterShort = TradeCounterShort + 1SET STOP pLOSS slset target pprofit tpENDIFalso another version that enters only if closes below the initial 4hr range
(this one the timeframe will affect performance)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253// Open Range Breakout DAX 5/15M// code-parameterDEFPARAM CumulateOrders = false// window high/low calculationONCE EndTime = 040000 //040000// trading windowONCE BuyTime = 040000 //040000ONCE SellTime = 150000 //150000sl = 150tp = 470// calculate high/low and sl/tpIF Time = EndTime THENDailyHigh = highest[4](high)DailyLow = lowest[4](low)tradeCounterLong = 0TradeCounterShort = 0ENDIF// position managementIF Time >= BuyTime AND Time <= SellTime and tradecounterlong <=1 and close> dailyhigh then //and tradecounterlong <=1// Long and currentdayofweek <5 and DClose(0)>DClose(1)buy 1 contract at marketTradeCounterLong = TradeCounterLong + 1SET STOP pLOSS slset target pprofit tpENDIFIF Time >= BuyTime AND Time <= SellTime and tradecountershort <=1 and close<dailylow then// Long and currentdayofweek <5 and DClose(0)>DClose(1) and tradecountershort <=1sellshort 1 contract at marketTradeCounterShort = TradeCounterShort + 1SET STOP pLOSS slset target pprofit tpENDIF11/12/2020 at 1:19 PM #15027511/12/2020 at 1:52 PM #15028211/12/2020 at 2:13 PM #150283 -
AuthorPosts
Find exclusive trading pro-tools on