syntax error on heikin ashi trend code?
Forums › ProRealTime English forum › ProOrder support › syntax error on heikin ashi trend code?
- This topic has 1 reply, 2 voices, and was last updated 5 years ago by
Nicolas.
Viewing 2 posts - 1 through 2 (of 2 total)
-
-
09/29/2020 at 9:14 PM #145896
Found this code browsing around this forum. Cant find a way around the errors? getting error on line 41, 43, 55 and 56
heiken123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199//————————————————————————-// Main Code : Heikin Ashi trend//————————————————————————-// Common RulesDefparam Cumulateorders = FalseDefparam Preloadbars = 1000// On/offExtratradecriteria = 1 // I.e. Long; Only Enters When The Current Bar High Is Lower Then The Lowest Daily High From Today, Yesterday And Day Before.Mfetrailing = 1 // Mfe Trailing StopWtrailing = 1 // Williams 3 Bar Trailing StopBreakevenstop = 1 // Breakevenstop, Move Stoploss When Position Is In Profit.Excludefirsttwoweeks = 1 // Exclude The First 2 Weeks Of Every Year (Weeknumber 1 And 2)lunchtrading = 0 // [0] no new positions during lunchtime and trades can be closed// SettingsPositionsize = 1SL = 1.00 // % StoplossPT = 140 // % Profit TargetMFETS = 0.50 // % Mfe Trailing StopBES = 0.35 // % Break Even StopBESMP = 0.05 // % Break Even Stop Minimum ProfitWTSMP = 0.50 // % Williams Trailing Stop Minimum Profit If Mfe Trailing Stop Is Not UsedETD = 0 // Exclude a Trade Day; Sunday = 0// Day & TimeOnce Entertime = 090000Once Lasttime = 170000Once Closetime = 240000 // Greater Then 23.59 Means It Continues Position OvernightOnce Closetimefr=173000if lunchtrading thenonce breakstart = 240000once breakend = 240000elseonce breakstart = 113000once breakend = 133000endifIf Excludefirsttwoweeks=1 ThenIf Year=2015 And Month=1 And (Day>=1 And Day=1 And Day=1 And Day=1 And Day=1 And Day= EntertimeTt2 = Time = breakstart and time <= breakendTradetime = Tt1 And Tt2 and Notrading = 0 And Dayofweek ETD and not breaktime// Reset At StartIf Intradaybarindex = 0 ThenLongtradecounter = 0Shorttradecounter = 0Tradecounter = 0Mclong = 0Mcshort = 0Endif// [pc] Position CriteriaPclong = Countoflongshares < 1 And Longtradecounter < 1 And Tradecounter TRADEINDEXPcshort = Countofshortshares < 1 And Shorttradecounter < 1 And Tradecounter TRADEINDEX// [mc] main criteriaif tradetime thenC3 = ExponentialAverage[32](close)//BLACKC4 = ExponentialAverage[48](close)//REDC5 = ExponentialAverage[192](close)//REDindicator1 = CALL “Heiken Ashi”c1 = (indicator1 = -1)c2 = (indicator1 = 1)IF c2 AND C4 > C5 AND C3 > C4 THENmclong=1mcshort=0elsemclong=0endifIf c1 AND C4 < C5 AND C3 < C4 THENmcshort=1mclong=0elsemcshort=0ENDIFendif// [ec] Extra CriteriaIf Extratradecriteria ThenMin1 = Min(Dhigh(0),dhigh(1))Min2 = Min(Dhigh(1),dhigh(2))Max1 = Max(Dlow(0),dlow(1))Max2 = Max(Dlow(1),dlow(2))Eclong = High Max(Max1,max2)elseEclong=1Ecshort=1Endif// Long & Short EntryIf not onmarket and Tradetime ThenIf Pclong and Mclong And Eclong ThenBuy Positionsize Contract At MarketLongtradecounter=longtradecounter + 1Tradecounter=tradecounter+1EndifIf Pcshort and Mcshort And Ecshort ThenSellshort Positionsize Contract At MarketShorttradecounter=shorttradecounter + 1Tradecounter=tradecounter+1EndifEndif// Break Even StopIf Breakevenstop ThenIf Not Onmarket ThenNewsl=0EndifIf Longonmarket And close-tradeprice(1)>=((Tradeprice/100)*BES)*pipsize ThenNewsl = Tradeprice(1)+((Tradeprice/100)*BESMP)*pipsizeEndifIf Shortonmarket And Tradeprice(1)-close>=((Tradeprice/100)*BES)*pipsize ThenNewsl = Tradeprice(1)-((Tradeprice/100)*BESMP)*pipsizeEndifIf Newsl>0 ThenSell At Newsl StopExitshort At Newsl StopEndifEndif// Exit Mfe Trailing StopIf Mfetrailing ThenTrailingstop = (Tradeprice/100)*MFETSIf Not Onmarket ThenMaxprice = 0Minprice = ClosePriceexit = 0EndifIf Longonmarket ThenMaxprice = Max(Maxprice,close)If Maxprice-tradeprice(1)>=trailingstop*pipsize ThenPriceexit = Maxprice-trailingstop*pipsizeEndifEndifIf Shortonmarket ThenMinprice = Min(Minprice,close)If Tradeprice(1)-minprice>=trailingstop*pipsize ThenPriceexit = Minprice+trailingstop*pipsizeEndifEndifIf Onmarket And Wtrailing=0 And Priceexit>0 ThenSell At MarketExitshort At MarketEndifEndif// Exit Williams Trailing StopIf Wtrailing ThenCount=1I=0J=i+1Tot=0While Count=low[i]) And (High[j]alto[1] ThenRef=bassoEndifIf CloseWTSMP ThenIf Low[1]>ref And High<ref ThenSell At MarketEndifIf High[1]ref ThenExitshort At MarketEndifEndifIf Onmarket And Mfetrailing=1 And Priceexit>0 ThenIf Highref ThenExitshort At MarketEndifEndifEndif// Exit At ClosetimeIf Onmarket ThenIf Time >= Closetime ThenSell At MarketExitshort At MarketEndifEndif// Exit At Closetime FridayIf Onmarket ThenIf (Currentdayofweek=5 And Time>=closetimefr) ThenSell At MarketExitshort At MarketEndifEndif// Build-in ExitSet Stop %loss SLSet Target %profit PT//graph 0 Coloured(300,0,0) As “Zeroline”//graph (Positionperf*100)coloured(0,0,0,255) As “Positionperformance”09/30/2020 at 9:16 AM #145927 -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
Find exclusive trading pro-tools on
Similar topics: