This forum is now read-only. You can discuss you questions on Forums of MQL4.community and MQL5.community
any there would help trying to learn :-) mt 3Back to topics list |
|
JannikKristensen
2005.07.04 05:19
I know it it not make sence that im trying to learn mt3 language but i will try to translate this one to mt4 after and if some one could help mee with this one :-) cant find out what there is wrong
/*[[ Name := parabolic Author := Copyright © 2005, MetaQuotes Software Corp. Link := http://www.metaquotes.net/ Lots := 01.00 Stop Loss := 25 Take Profit := 50 Trailing Stop := 0 ]]*/ Defines: ParSARstep(0.0200), ParSARmax(0.2000), var: status(0), PARval(0), lastclose(0), currentopen(0), prevtime(0), aboveParSAR(false), belowParSAR(false), slippage(0); /* status = 0 : no open position alerts. status = 1 : open buy position alerted. status = -1 : open sell position alerted. */ // only execute once per bar. if prevtime = Time then exit; prevtime = Time; // get the indicator values, and // determine location of close. lastclose = Close[1]; currentopen = Open[0]; slippage = ask - bid; PARval = iSAR(ParSARstep, ParSARmax, 1); aboveParSAR = lastclose - PARval >= Point; belowParSAR = PARval - lastclose >= Point; // now do alerts upon conditions being met. // no open position alerts, so check to open a position. if status = 0 then { if aboveParSAR then { if IsTesting then SetOrder(OP_BUY,Lots,currentopen,slippage,0,0,Blue) else alert("Open long position."); status = 1; }; if belowParSAR then { if IsTesting then SetOrder(OP_SELL,Lots,currentopen,slippage,0,0,Red) else alert("Open short position."); status = -1; }; }; // long position open, so check for close alert. if status > 0 then { if (not aboveParSAR) then { if IsTesting then CloseOrder(OrderValue(1,VAL_TICKET),OrderValue(1,VAL_LOTS),currentopen,slippage,DarkBlue) else alert("Close long position."); status = 0; }; }; // short position open, so check for close alert. if status < 0 then { if (not belowParSAR) then { if IsTesting then CloseOrder(OrderValue(1,VAL_TICKET),OrderValue(1,VAL_LOTS),currentopen,slippage,DarkRed) else alert("Close short position."); status = 0; }; }; getting an error saying unespected token "var" hope some one will help and thanks |
|
Vooch
2005.07.04 05:45
I don't know MT3, but if I were to guess, I would say the following line needs to be on one line:
var: status(0), PARval(0), lastclose(0), currentopen(0), prevtime(0), aboveParSAR(false), belowParSAR(false), slippage(0); |
|
GJim
2005.07.04 06:39
This code line:
Defines: ParSARstep(0.0200), ParSARmax(0.2000), needs to be changed to: Defines: ParSARstep(0.0200), ParSARmax(0.2000); (semi-colon at end of line). That will eliminate your complilation/syntax error. No comments on the accuracy of the indicator itself. G'Jim c):{- |
|
JannikKristensen
2005.07.04 06:59
Thanks got it cheers thanks for the help
|
|
JannikKristensen
2005.07.04 07:03
i have a new one here hehe trying
ArrayCopyRates(rates_w1, Symbol(), PERIOD_w1); says period _w1 not definied MQ4 |
|
mpfx
2005.07.04 09:44
It's capital W not w
|
|
JannikKristensen
2005.07.04 12:12
It's capital W not w upps :-) yes its working |
