Conversion d'un code mql4 de fibo
Forums › ProRealTime forum Français › Support ProBuilder › Conversion d'un code mql4 de fibo
- This topic has 1 reply, 2 voices, and was last updated 8 years ago by Nicolas.
-
-
05/24/2016 at 6:41 PM #7906
Bonjour,
je cherche à convertir ce code qui me donnera des indicateurs selon la suite de Fibonacci vers le langage Probuilder.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123property indicator_chart_windowproperty indicator_buffers 3//+----------------------------------------------------------------------------------------------------------------------------------------+//---- input parameters//+----------------------------------------------------------------------------------------------------------------------------------------+extern color Fib_Long =Blue;extern int Fib_Long_Style =1;extern int Fib_Long_Width =1;//+----------------------------------------------------------------------------------------------------------------------------------------+extern color Fib_Short = Yellow;extern int Fib_Short_Style=1;extern int Fib_Short_Width=1;//+----------------------------------------------------------------------------------------------------------------------------------------+extern color Fib_Intraday = Pink;extern int Fib_Intraday_Style=1;extern int Fib_Intraday_Width=1;//+----------------------------------------------------------------------------------------------------------------------------------------+//+----------------------------------------------------------------------------------------------------------------------------------------+double HiPrice, LoPrice, Range;datetime StartTime;int init(){return(0);}int deinit(){ObjectDelete("LongFibo");ObjectDelete("ShortFibo");ObjectDelete("IntradayFibo");return(0);}//+------------------------------------------------------------------+//| Draw Fibo//+------------------------------------------------------------------+int DrawFibo(){if(ObjectFind("LongFibo") == -1)ObjectCreate("LongFibo",OBJ_FIBO,0,StartTime,HiPrice+Range,StartTime,HiPrice);else{ObjectSet("LongFibo",OBJPROP_TIME2, StartTime);ObjectSet("LongFibo",OBJPROP_TIME1, StartTime);ObjectSet("LongFibo",OBJPROP_PRICE1,HiPrice+Range);ObjectSet("LongFibo",OBJPROP_PRICE2,HiPrice);}ObjectSet("LongFibo",OBJPROP_LEVELCOLOR,Fib_Long);ObjectSet("LongFibo",OBJPROP_LEVELSTYLE,Fib_Long_Style);ObjectSet("LongFibo",OBJPROP_LEVELWIDTH,Fib_Long_Width);ObjectSet("LongFibo",OBJPROP_FIBOLEVELS,2);ObjectSet("LongFibo",OBJPROP_FIRSTLEVEL+0,0.34); ObjectSetFiboDescription("LongFibo",0,"Daily Long Target 1 - %$");ObjectSet("LongFibo",OBJPROP_FIRSTLEVEL+1,0.55); ObjectSetFiboDescription("LongFibo",1,"Daily Long Target 2 - %$");ObjectSet("LongFibo",OBJPROP_RAY,true);ObjectSet("LongFibo",OBJPROP_BACK,true);if(ObjectFind("ShortFibo") == -1)ObjectCreate("ShortFibo",OBJ_FIBO,0,StartTime,LoPrice-Range,StartTime,LoPrice);else{ObjectSet("ShortFibo",OBJPROP_TIME2, StartTime);ObjectSet("ShortFibo",OBJPROP_TIME1, StartTime);ObjectSet("ShortFibo",OBJPROP_PRICE1,LoPrice-Range);ObjectSet("ShortFibo",OBJPROP_PRICE2,LoPrice);}ObjectSet("ShortFibo",OBJPROP_LEVELCOLOR,Fib_Short);ObjectSet("ShortFibo",OBJPROP_LEVELSTYLE,Fib_Short_Style);ObjectSet("ShortFibo",OBJPROP_LEVELWIDTH,Fib_Short_Width);ObjectSet("ShortFibo",OBJPROP_FIBOLEVELS,2);ObjectSet("ShortFibo",OBJPROP_FIRSTLEVEL+0,0.34); ObjectSetFiboDescription("ShortFibo",0,"Daily Short Target 1 - %$");ObjectSet("ShortFibo",OBJPROP_FIRSTLEVEL+1,0.55); ObjectSetFiboDescription("ShortFibo",1,"Daily Short Target 2 - %$");ObjectSet("ShortFibo",OBJPROP_RAY,true);ObjectSet("ShortFibo",OBJPROP_BACK,true);if(ObjectFind("IntradayFibo") == -1)ObjectCreate("IntradayFibo",OBJ_FIBO,0,StartTime,HiPrice,StartTime+PERIOD_D1*60,LoPrice);else{ObjectSet("IntradayFibo",OBJPROP_TIME2, StartTime);ObjectSet("IntradayFibo",OBJPROP_TIME1, StartTime+PERIOD_D1*60);ObjectSet("IntradayFibo",OBJPROP_PRICE1,HiPrice);ObjectSet("IntradayFibo",OBJPROP_PRICE2,LoPrice);}ObjectSet("IntradayFibo",OBJPROP_LEVELCOLOR,Fib_Intraday);ObjectSet("IntradayFibo",OBJPROP_LEVELSTYLE,Fib_Intraday_Style);ObjectSet("IntradayFibo",OBJPROP_LEVELWIDTH,Fib_Intraday_Width);ObjectSet("IntradayFibo",OBJPROP_FIBOLEVELS,7);ObjectSet("IntradayFibo",OBJPROP_FIRSTLEVEL+0,0.0); ObjectSetFiboDescription("IntradayFibo",0,"Intraday Low - %$");ObjectSet("IntradayFibo",OBJPROP_FIRSTLEVEL+1,0.191); ObjectSetFiboDescription("IntradayFibo",1,"Intraday S1 - %$");ObjectSet("IntradayFibo",OBJPROP_FIRSTLEVEL+2,0.382); ObjectSetFiboDescription("IntradayFibo",2,"Intraday Short - %$");ObjectSet("IntradayFibo",OBJPROP_FIRSTLEVEL+3,0.500); ObjectSetFiboDescription("IntradayFibo",3,"Intraday Pivot - %$");ObjectSet("IntradayFibo",OBJPROP_FIRSTLEVEL+4,0.618); ObjectSetFiboDescription("IntradayFibo",4,"Intraday Long - %$");ObjectSet("IntradayFibo",OBJPROP_FIRSTLEVEL+5,0.809); ObjectSetFiboDescription("IntradayFibo",5,"Intraday R1 - %$");ObjectSet("IntradayFibo",OBJPROP_FIRSTLEVEL+6,1.000); ObjectSetFiboDescription("IntradayFibo",6,"Intraday High - %$");ObjectSet("IntradayFibo",OBJPROP_RAY,true);ObjectSet("IntradayFibo",OBJPROP_BACK,true);}//+------------------------------------------------------------------+//| Indicator start function//+------------------------------------------------------------------+int start(){int shift = iBarShift(NULL,PERIOD_D1,Time[0]) + 1; // yesterdayHiPrice = iHigh(NULL,PERIOD_D1,shift);LoPrice = iLow (NULL,PERIOD_D1,shift);StartTime = iTime(NULL,PERIOD_D1,shift);if(TimeDayOfWeek(StartTime)==0/*Sunday*/){//Add fridays high and lowHiPrice = MathMax(HiPrice,iHigh(NULL,PERIOD_D1,shift+1));LoPrice = MathMin(LoPrice,iLow(NULL,PERIOD_D1,shift+1));}Range = HiPrice-LoPrice;DrawFibo();return(0);}//+------------------------------------------------------------------+Et j’aurai besoin de votre aide pour trouver des fonctions équivalentes sur Probuilder vu que je ne suis pas très familier avec les deux langages.
Voilà ce que j’ai fait pour l’instant :
123456789101112shift =HiPrice =LoPrice =StartTime =IF (we are sunday) THENHiPrice = MAX(Hiprice, )LoPrice = MIN(LoPrice, )ENDIFRange = HipPrice-LopriceRETURN LongFibo AS "LongFibo" COLOURED(0, 0, 255), ShortFibo AS "ShortFibo" COLOURED(255, 255, 0), IntradayFibo AS "IntradayFibo" COLOURED(255, 0, 255)Merci d’avance.
05/25/2016 at 10:38 AM #7970Bonjour,
Tu es sur le début de quelque-chose, voici pour t’aider des pistes pour calculer des seuils Fibonacci en fonction des données de la veille:
http://www.prorealcode.com/prorealtime-indicators/fibonacci-pivot-points/
de données de la Xème periode en arrière:
http://www.prorealcode.com/prorealtime-indicators/fibonacci-auto-channel/
http://www.prorealcode.com/prorealtime-market-screeners/fibonacci-61-8-retracement/
Bon courage!
-
AuthorPosts
Find exclusive trading pro-tools on