Syntax error in assignment – Help needed
Forums › ProRealTime English forum › ProOrder support › Syntax error in assignment – Help needed
- This topic has 2 replies, 3 voices, and was last updated 5 years ago by Nicolas.
Viewing 3 posts - 1 through 3 (of 3 total)
-
-
08/09/2018 at 12:46 PM #77858
Hello:
I am seeing the following error when i try to run a back-test on the code below.
“Syntax error in assignment”
I can’t figure out what’s wrong. Can any of you find out where is the mistake?
Thanks.
syntax error in assignment help123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104DEFPARAM CumulateOrders = falseReinvest=1if reinvest thenCapital = 10000Risk = 1//0.1//in % pr positionStopLoss = 48REM Calculate contractsequity = Capital + StrategyProfitmaxrisk = round(equity*(Risk/100))MAXpositionsize=5000MINpositionsize=1Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(round((maxrisk/StopLoss)))))//*Pointsize))))elsePositionsize=1StopLoss = 48Endif///BILL WILLIAM FRACTAL INDICATOR//CP=PERIODCP=113if close[cp] >= highest[2*cp+1](close) thenLH = 1elseLH=0endifif close[cp] <= lowest[2*cp+1](close) thenLL= -1elseLL=0endifif LH=1 thenHIL = close[cp]endifif LL = -1 thenLOL=close[cp]endif// RETURN, HIL COLOURED(0,200,0) AS "BREAKOUT LEVEL LONG",HIL COLOURED(200,0,0) AS "BREAKOUT LEVEL SHORT"//LONG and SHORT CONDITIONS//Positionsize=1if (time >=100000 and time < 230000) thenC1 = (close CROSSES OVER HIL)D1 = (close CROSSES UNDER LOL)IF c1 and not shortonmarket THENBUY positionsize CONTRACT AT MARKETInitialStopLong = LowENDIFIF D1 and not longonmarket THENSELLSHORT positionsize CONTRACT AT MARKETInitialStopShort = HighENDIFENDIF//TRAILING STOPTGL =5TGS=5if not onmarket thenMAXPRICE = 0MINPRICE = closePREZZOUSCITA = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL*pointsize thenPREZZOUSCITA = MAXPRICE-TGL*pointsizeENDIFENDIFif shortonmarket thenMINPRICE = MIN(MINPRICE,close)if tradeprice(1)-MINPRICE>=TGS*pointsize thenPREZZOUSCITA = MINPRICE+TGS*pointsizeENDIFENDIFif onmarket and PREZZOUSCITA>0 thenEXITSHORT AT PREZZOUSCITA STOPSELL AT PREZZOUSCITA STOPENDIF// DONCHIAN STOPDC=20e= Highest[DC](high)f=Lowest[DC](low)if longonmarket thenlaststop = f[1]endifif shortonmarket thenlaststop = e[1]endifif longonmarket AND initialStopLong>laststop thenSell at InitialStopLongELSEsell at laststop stopEndifIf shortonmarket AND initialStopShort<laststop thenExitshort at InitialStopShortELSEexitshort at laststop stopEndifset target profit 30set stop loss stoploss*pointsize08/09/2018 at 12:51 PM #7785908/09/2018 at 12:53 PM #77860Don’t know why but there where wrong formatted copy/paste code and some syntax errors too, here is the fixed code:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102DEFPARAM CumulateOrders = falseReinvest=1if reinvest thenCapital = 10000Risk = 1//0.1//in % pr positionStopLoss = 48REM Calculate contractsequity = Capital + StrategyProfitmaxrisk = round(equity*(Risk/100))MAXpositionsize=5000MINpositionsize=1Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(round((maxrisk/StopLoss)))))//*Pointsize))))elsePositionsize=1StopLoss = 48Endif///BILL WILLIAM FRACTAL INDICATOR//CP=PERIODCP=113if close[cp] >= highest[2*cp+1](close) thenLH = 1elseLH=0endifif close[cp] <= lowest[2*cp+1](close) thenLL= -1elseLL=0endifif LH=1 thenHIL = close[cp]endifif LL= -1 thenLOL=close[cp]endif// RETURN, HIL COLOURED(0,200,0) AS "BREAKOUT LEVEL LONG",HIL COLOURED(200,0,0) AS "BREAKOUT LEVEL SHORT"//LONG and SHORT CONDITIONS//Positionsize=1if (time >=100000 and time < 230000) thenC1 = (close CROSSES OVER HIL)D1 = (close CROSSES UNDER LOL)IF c1 and not shortonmarket THENBUY positionsize CONTRACT AT MARKETInitialStopLong = LowENDIFIF D1 and not longonmarket THENSELLSHORT positionsize CONTRACT AT MARKETInitialStopShort = HighENDIFENDIF//TRAILING STOPTGL =5TGS=5if not onmarket thenMAXPRICE = 0MINPRICE = closePREZZOUSCITA = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL*pointsize thenPREZZOUSCITA = MAXPRICE-TGL*pointsizeENDIFENDIFif shortonmarket thenMINPRICE = MIN(MINPRICE,close)if tradeprice(1)-MINPRICE>=TGS*pointsize thenPREZZOUSCITA = MINPRICE+TGS*pointsizeENDIFENDIFif onmarket and PREZZOUSCITA>0 thenEXITSHORT AT PREZZOUSCITA STOPSELL AT PREZZOUSCITA STOPENDIF// DONCHIAN STOPDC=20e= Highest[DC](high)f=Lowest[DC](low)if longonmarket thenlaststop = f[1]endifif shortonmarket thenlaststop = e[1]endifif longonmarket AND initialStopLong>laststop thenSell at InitialStopLong stopELSEsell at laststop stopEndifIf shortonmarket AND initialStopShort<laststop thenExitshort at InitialStopShort stopELSEexitshort at laststop stopEndifset target profit 30set stop loss stoploss*pointsize -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
Find exclusive trading pro-tools on
Similar topics: