ci sono errori in questo EA?…
- User
ci sono errori in questo EA? //+------------------------------------------------------------------+ //| ProjectName | //| NO Copyright 2012, CompanyName | //| http://www.companyname.net | //+------------------------------------------------------------------+ extern string INFO1="===== Volume =============================="; extern double LotsSize=0.0; extern string INFO_="----------------------------------------------"; extern double LotsPer1000=0.3; extern double MinLots = 0.01; extern double MaxLots = 60.0; extern string INFO2="===== Protection ============================"; extern double def_MaxSpread=1.3; extern string INFO3 = "===== Confirmation =========================="; extern int BB_PARAM = 23; extern int RSI_PARAM = 18; extern double def_SL = 3.0; extern string INFO4="===== More ==============================="; extern int MyMagicNumber=68000; extern string Comment_="Price Action Scalping v1.68";
int Gi_180=0; double G_pips_184= 0.0; int G_digits_192 = 0; double G_point_196=0.0; int Gi_204; double Gd_208; double Gd_216; double Gd_224; double Gd_232; double Gd_240; double Gd_248; double Gd_256; int G_slippage_264=3; bool Gi_268; double Gd_272; double Gda_280[30]; int Gi_284=0; string Gs_dummy_288; string Gs_unused_316 = ""; string Gs_unused_324 = ""; double Gd_336; double Gd_344; int G_time_352; int Gi_356; int G_datetime_360; string Gs_364 = "000,000,000"; string Gs_372 = "000,000,255"; int Gi_380; int Gi_384; int Filter=185; int StopLoss; double Risk; bool UseMM; double MaxSpreadPlusCommission=10000.0; int Limit=20; int Distance = 21; int MAPeriod = 3; int MAMethod = 3; string TimeFilter="----------Time Filter"; int StartHour=0; int StartMinute=0; int EndHour=23; int EndMinute=59; int Gi_388; int Gi_392=40; double G_timeframe_396=240.0; bool Gi_404=TRUE; color G_color_408 = DimGray; string G_name_412 = "SpreadIndikatorObj"; double Gd_420; color G_color_428 = Red; color G_color_432 = DarkGray; color G_color_436 = SpringGreen; bool Gi_440=TRUE; double G_ihigh_444; double G_ilow_452; double Gd_460; int G_datetime_468; // E37F0136AA3FFAF149B351F6A4C948E9 int init() { StopLoss=def_SL10.0; def_MaxSpread=def_MaxSpread10; if(LotsSize==0.0) { UseMM=TRUE; } else { UseMM=FALSE; } Risk=LotsPer1000*20; int timeframe_8; ArrayInitialize(Gda_280,0); G_digits_192= Digits; G_point_196 = Point; Print("Digits: "+G_digits_192+" Point: "+DoubleToStr(G_point_196,G_digits_192)); double lotstep_0=MarketInfo(Symbol(),MODE_LOTSTEP); Gi_204 = MathLog(lotstep_0) / MathLog(0.1); Gd_208 = MathMax(MinLots, MarketInfo(Symbol(), MODE_MINLOT)); Gd_216 = MathMin(MaxLots, MarketInfo(Symbol(), MODE_MAXLOT)); Gd_224 = Risk / 100.0; Gd_232 = NormalizeDouble(MaxSpreadPlusCommission * G_point_196, G_digits_192 + 1); Gd_240 = NormalizeDouble(Limit * G_point_196, G_digits_192); Gd_248 = NormalizeDouble(Distance * G_point_196, G_digits_192); Gd_256 = NormalizeDouble(G_point_196 * Filter, G_digits_192); Gi_268 = FALSE; Gd_272 = NormalizeDouble(G_pips_184 * G_point_196, G_digits_192 + 1); if(!IsTesting()) { f0_8(); if(Gi_404) { timeframe_8=Period(); switch(timeframe_8) { case PERIOD_M1: G_timeframe_396=5; break; case PERIOD_M5: G_timeframe_396=15; break; case PERIOD_M15: G_timeframe_396=30; break; case PERIOD_M30: G_timeframe_396=60; break; case PERIOD_H1: G_timeframe_396=240; break; case PERIOD_H4: G_timeframe_396=1440; break; case PERIOD_D1: G_timeframe_396=10080; break; case PERIOD_W1: G_timeframe_396=43200; break; case PERIOD_MN1: G_timeframe_396=43200; } } Gd_420=0.0001; f0_7(); f0_2(); f0_0(); f0_3(); } return (0); } // 52D46093050F38C27267BCE42543EF60 int deinit() { if(!IsTesting()) { for(int Li_0=1; Li_0<=Gi_392; Li_0++) ObjectDelete("Padding_rect"+Li_0); for(int count_4=0; count_4<10; count_4++) { ObjectDelete("BD"+count_4); ObjectDelete("SD"+count_4); } ObjectDelete("time"); ObjectDelete(G_name_412); } Comment(""); ObjectDelete("B3LLogo"); ObjectDelete("B3LCopy"); ObjectDelete("FiboUp"); ObjectDelete("FiboDn"); ObjectDelete("FiboIn"); return (0); } // EA2B2676C28C0DB26D39331A336C6B92 int start() {
//StopLoss = StopLoss + MarketInfo(Symbol(),MODE_SPREAD); int error_8; string Ls_12; int ticket_20; double price_24; bool bool_32; double Ld_36; double Ld_44; double price_60; double Ld_112; int Li_180; int cmd_188; double Ld_196; double Ld_204; double ihigh_68= iHigh(NULL,0,0); double ilow_76 = iLow(NULL,0,0); // double ima_84 = iMA(NULL, 0, MAPeriod, Gi_180, MAMethod, PRICE_LOW, 0); // double ima_92 = iMA(NULL, 0, MAPeriod, Gi_180, MAMethod, PRICE_HIGH, 0); double ibands_84=iBands(Symbol(),Period(),BB_PARAM,2.0,0,PRICE_CLOSE,MODE_UPPER,0); double ibands_92=iBands(Symbol(),Period(),BB_PARAM,2.0,0,PRICE_CLOSE,MODE_LOWER,0);
double irsi_96=iRSI(Symbol(),Period(),RSI_PARAM,PRICE_CLOSE,0);
if(!Gi_268) { for(int pos_108=OrdersHistoryTotal()-1; pos_108>=0; pos_108--) { if(OrderSelect(pos_108,SELECT_BY_POS,MODE_HISTORY)) { if(OrderProfit()!=0.0) { if(OrderClosePrice()!=OrderOpenPrice()) { if(OrderSymbol()==Symbol()) { Gi_268 = TRUE; Ld_112 = MathAbs(OrderProfit() / (OrderClosePrice() - OrderOpenPrice())); Gd_272 = (-OrderCommission()) / Ld_112; break; } } } } } }
double Ld_120=Ask-Bid; ArrayCopy(Gda_280,Gda_280,0,1,29); Gda_280[29]=Ld_120; if(Gi_284<30) Gi_284++; double Ld_128=0; pos_108=29; for(int count_136=0; count_136<Gi_284; count_136++) { Ld_128+=Gda_280[pos_108]; pos_108--; } double Ld_140 = Ld_128 / Gi_284; double Ld_148 = NormalizeDouble(Ask + Gd_272, G_digits_192); double Ld_156 = NormalizeDouble(Bid - Gd_272, G_digits_192); double Ld_164 = NormalizeDouble(Ld_140 + Gd_272, G_digits_192 + 1); double Ld_172 = ihigh_68 - ilow_76; if(Ld_172>Gd_256) { if(Bid<ibands_92 && irsi_96<50.0) Li_180=-1; else if(Bid>ibands_84 && irsi_96>50.0) Li_180=1; } int count_184=0; for(pos_108=0; pos_108<OrdersTotal(); pos_108++) { if(OrderSelect(pos_108,SELECT_BY_POS,MODE_TRADES)) { if(OrderMagicNumber()==MyMagicNumber) { cmd_188=OrderType(); if(cmd_188==OP_BUYLIMIT || cmd_188==OP_SELLLIMIT) continue; if(OrderSymbol()==Symbol()) { count_184++; switch(cmd_188) { case OP_BUY: if(Distance<0) break; Ld_44=NormalizeDouble(OrderStopLoss(),G_digits_192); price_60=NormalizeDouble(Bid-Gd_248,G_digits_192); if(!((Ld_44==0.0 || price_60>Ld_44))) break; bool_32=OrderModify(OrderTicket(),OrderOpenPrice(),price_60,OrderTakeProfit(),0,Lime); if(!(!bool_32)) break; error_8=GetLastError(); Print("BUY Modify Error Code: "+error_8+" Message: "+Ls_12+" OP: "+DoubleToStr(price_24,G_digits_192)+" SL: "+DoubleToStr(price_60,G_digits_192)+ " Bid: "+DoubleToStr(Bid,G_digits_192)+" Ask: "+DoubleToStr(Ask,G_digits_192)); break; case OP_SELL: if(Distance<0) break; Ld_44=NormalizeDouble(OrderStopLoss(),G_digits_192); price_60=NormalizeDouble(Ask+Gd_248,G_digits_192); if(!((Ld_44==0.0 || price_60<Ld_44))) break; bool_32=OrderModify(OrderTicket(),OrderOpenPrice(),price_60,OrderTakeProfit(),0,Orange); if(!(!bool_32)) break; error_8=GetLastError(); Print("SELL Modify Error Code: "+error_8+" Message: "+Ls_12+" OP: "+DoubleToStr(price_24,G_digits_192)+" SL: "+DoubleToStr(price_60,G_digits_192)+ " Bid: "+DoubleToStr(Bid,G_digits_192)+" Ask: "+DoubleToStr(Ask,G_digits_192)); break; case OP_BUYSTOP: Ld_36=NormalizeDouble(OrderOpenPrice(),G_digits_192); price_24=NormalizeDouble(Ask+Gd_240,G_digits_192); if(!((price_24<Ld_36))) break; price_60= NormalizeDouble(price_24 -(StopLoss+MarketInfo(Symbol(),MODE_SPREAD)) * Point,G_digits_192); bool_32 = OrderModify(OrderTicket(),price_24,price_60,OrderTakeProfit(),0,Lime); if(!(!bool_32)) break; error_8=GetLastError(); Print("BUYSTOP Modify Error Code: "+error_8+" Message: "+Ls_12+" OP: "+DoubleToStr(price_24,G_digits_192)+" SL: "+DoubleToStr(price_60,G_digits_192)+ " Bid: "+DoubleToStr(Bid,G_digits_192)+" Ask: "+DoubleToStr(Ask,G_digits_192)); break; case OP_SELLSTOP: Ld_36=NormalizeDouble(OrderOpenPrice(),G_digits_192); price_24=NormalizeDouble(Bid-Gd_240,G_digits_192); if(!((price_24>Ld_36))) break; price_60= NormalizeDouble(price_24+(StopLoss+MarketInfo(Symbol(),MODE_SPREAD)) * Point,G_digits_192); bool_32 = OrderModify(OrderTicket(),price_24,price_60,OrderTakeProfit(),0,Orange); if(!(!bool_32)) break; error_8=GetLastError(); Print("SELLSTOP Modify Error Code: "+error_8+" Message: "+Ls_12+" OP: "+DoubleToStr(price_24,G_digits_192)+" SL: "+DoubleToStr(price_60,G_digits_192)+ " Bid: "+DoubleToStr(Bid,G_digits_192)+" Ask: "+DoubleToStr(Ask,G_digits_192)); } } } } } if(count_184==0 && Li_180!=0 && Ld_164<=Gd_232 && f0_4()) { Ld_196=AccountBalance()*AccountLeverage()*Gd_224; if(!UseMM) Ld_196=LotsSize; Ld_204 = NormalizeDouble(Ld_196 / MarketInfo(Symbol(), MODE_LOTSIZE), Gi_204); Ld_204 = MathMax(Gd_208, Ld_204); Ld_204 = MathMin(Gd_216, Ld_204); if(Li_180<0) { price_24 = NormalizeDouble(Ask + Gd_240, G_digits_192); price_60 = NormalizeDouble(price_24 - (StopLoss+ MarketInfo(Symbol(),MODE_SPREAD)) * Point, G_digits_192);
if(MarketInfo(Symbol(),MODE_SPREAD)<def_MaxSpread) ticket_20=OrderSend(Symbol(),OP_BUYSTOP,Ld_204,price_24,G_slippage_264,price_60,0,Comment_,MyMagicNumber,0,Lime); if(ticket_20<=0) { error_8=GetLastError(); Print("BUYSTOP Send Error Code: "+error_8+" Message: "+Ls_12+" LT: "+DoubleToStr(Ld_204,Gi_204)+" OP: "+DoubleToStr(price_24,G_digits_192)+" SL: "+ DoubleToStr(price_60,G_digits_192)+" Bid: "+DoubleToStr(Bid,G_digits_192)+" Ask: "+DoubleToStr(Ask,G_digits_192)); } } else { price_24 = NormalizeDouble(Bid - Gd_240, G_digits_192); price_60 = NormalizeDouble(price_24 + (StopLoss+ MarketInfo(Symbol(),MODE_SPREAD)) * Point, G_digits_192); if(MarketInfo(Symbol(),MODE_SPREAD)<def_MaxSpread) ticket_20=OrderSend(Symbol(),OP_SELLSTOP,Ld_204,price_24,G_slippage_264,price_60,0,Comment_,MyMagicNumber,0,Orange); if(ticket_20<=0) { error_8=GetLastError(); Print("BUYSELL Send Error Code: "+error_8+" Message: "+Ls_12+" LT: "+DoubleToStr(Ld_204,Gi_204)+" OP: "+DoubleToStr(price_24,G_digits_192)+" SL: "+ DoubleToStr(price_60,G_digits_192)+" Bid: "+DoubleToStr(Bid,G_digits_192)+" Ask: "+DoubleToStr(Ask,G_digits_192)); } } }string Ls_212="AvgSpread:"+DoubleToStr(Ld_140,G_digits_192)+" Commission rate:"+DoubleToStr(Gd_272,G_digits_192+1)+" Real avg. spread:"+DoubleToStr(Ld_164, G_digits_192+1); if(Ld_164>Gd_232) { Ls_212=Ls_212 +"\n" +"The EA can not run with this spread ( "+DoubleToStr(Ld_164,G_digits_192+1)+" > "+DoubleToStr(Gd_232,G_digits_192+1)+" )"; } if(count_184!=0 || Li_180!=0) { } if(!IsTesting()) { f0_2(); f0_7(); f0_0(); f0_3(); f0_8(); } return (0); } // 3B8B9927CE5F3E077818404E64D1C252 int f0_4() { if((Hour() > StartHour && Hour() < EndHour) || (Hour() == StartHour && Minute() >= StartMinute) || (Hour() == EndHour && Minute() < EndMinute)) return (1); return (0); } // DFF63C921B711879B02EDBCAFB9A05B0 void f0_8() { Gd_336 = WindowPriceMax(); Gd_344 = WindowPriceMin(); G_time_352=Time[WindowFirstVisibleBar()]; Gi_356=WindowFirstVisibleBar()-WindowBarsPerChart(); if(Gi_356<0) Gi_356=0; G_datetime_360=Time[Gi_356]+60*Period(); for(int Li_0=1; Li_0<=Gi_392; Li_0++) { if(ObjectFind("Padding_rect"+Li_0)==-1) ObjectCreate("Padding_rect"+Li_0,OBJ_RECTANGLE,0,G_time_352,Gd_336 -(Gd_336-Gd_344)/Gi_392 (Li_0-1),G_datetime_360,Gd_336 -(Gd_336-Gd_344)/Gi_392Li_0); ObjectSet("Padding_rect"+Li_0,OBJPROP_TIME1,G_time_352); ObjectSet("Padding_rect"+Li_0,OBJPROP_TIME2,G_datetime_360-1); ObjectSet("Padding_rect"+Li_0,OBJPROP_PRICE1,Gd_336 -(Gd_336-Gd_344)/Gi_392 (Li_0-1)); ObjectSet("Padding_rect"+Li_0,OBJPROP_PRICE2,Gd_336 -(Gd_336-Gd_344)/Gi_392Li_0); ObjectSet("Padding_rect"+Li_0,OBJPROP_BACK,TRUE); ObjectSet("Padding_rect"+Li_0,OBJPROP_COLOR,f0_9(Gs_364,Gs_372,Gi_392,Li_0)); } WindowRedraw(); } // F7E068A881FC08598B50EAA72BECD80C int f0_9(string As_0,string As_8,int Ai_16,int Ai_20) { int str2int_24 = StrToInteger(StringSubstr(As_0, 0, 3)); int str2int_28 = StrToInteger(StringSubstr(As_0, 4, 3)); int str2int_32 = StrToInteger(StringSubstr(As_0, 8, 3)); int str2int_36 = StrToInteger(StringSubstr(As_8, 0, 3)); int str2int_40 = StrToInteger(StringSubstr(As_8, 4, 3)); int str2int_44 = StrToInteger(StringSubstr(As_8, 8, 3)); if(str2int_24 > str2int_36) Gi_380 = str2int_24 + (str2int_36 - str2int_24) / Ai_16 * Ai_20; if(str2int_24 < str2int_36) Gi_380 = str2int_24 - (str2int_24 - str2int_36) / Ai_16 * Ai_20; if(str2int_28 > str2int_40) Gi_384 = str2int_28 + (str2int_40 - str2int_28) / Ai_16 * Ai_20; if(str2int_28 < str2int_40) Gi_384 = str2int_28 - (str2int_28 - str2int_40) / Ai_16 * Ai_20; if(str2int_32 > str2int_44) Gi_388 = str2int_32 + (str2int_44 - str2int_32) / Ai_16 * Ai_20; if(str2int_32 < str2int_44) Gi_388 = str2int_32 - (str2int_32 - str2int_44) / Ai_16 * Ai_20; Gi_384 = 256; Gi_388<<= 16; return (Gi_380 + Gi_384 + Gi_388); } // 2795031E32D1FE85C9BD72823A8B4142 void f0_2() { double Lda_0[10]; double Lda_4[10]; double Lda_8[10]; double Lda_12[10]; int Li_16; int Li_20; int Li_24; int Li_32; if(Period()<G_timeframe_396) { ArrayCopySeries(Lda_0,2,Symbol(),G_timeframe_396); ArrayCopySeries(Lda_4,1,Symbol(),G_timeframe_396); ArrayCopySeries(Lda_8,0,Symbol(),G_timeframe_396); ArrayCopySeries(Lda_12,3,Symbol(),G_timeframe_396); Li_32=3; for(int Li_28=2; Li_28>=0; Li_28--) { Li_20 = Time[0] + Period() * (90 * Li_32); Li_24 = Time[0] + 90 * (Period() * (Li_32 + 1)); if(ObjectFind("BD"+Li_28)==-1) { if(Lda_8[Li_28]>Lda_12[Li_28]) Li_16=170; else Li_16=43520; f0_6("D"+Li_28,Li_20,Li_24,Lda_8[Li_28],Lda_12[Li_28],Lda_4[Li_28],Lda_0[Li_28],Li_16); } else { if(Lda_8[Li_28]>Lda_12[Li_28]) Li_16=170; else Li_16=43520; f0_5("D"+Li_28,Li_20,Li_24,Lda_8[Li_28],Lda_12[Li_28],Lda_4[Li_28],Lda_0[Li_28],Li_16); } Li_32++; Li_32++; } } } // 9F92396C933453E2D1202389D9EFB0E5 void f0_6(string As_0,int A_datetime_8,int A_datetime_12,double A_price_16,double A_price_24,double A_price_32,double A_price_40,color A_color_48) { if(A_price_16==A_price_24) A_color_48=Gray; ObjectCreate("B"+As_0,OBJ_RECTANGLE,0,A_datetime_8,A_price_16,A_datetime_12,A_price_24); ObjectSet("B"+As_0,OBJPROP_STYLE,STYLE_SOLID); ObjectSet("B"+As_0,OBJPROP_COLOR,A_color_48); ObjectSet("B"+As_0,OBJPROP_BACK,TRUE); int datetime_52=A_datetime_8+(A_datetime_12-A_datetime_8)/2; ObjectCreate("S"+As_0,OBJ_TREND,0,datetime_52,A_price_32,datetime_52,A_price_40); ObjectSet("S"+As_0,OBJPROP_COLOR,A_color_48); ObjectSet("S"+As_0,OBJPROP_BACK,TRUE); ObjectSet("S"+As_0,OBJPROP_RAY,FALSE); ObjectSet("S"+As_0,OBJPROP_WIDTH,2); } // 88F07BF2A3E2A04159AC984719B3F549 void f0_5(string As_0,int A_datetime_8,int A_datetime_12,double Ad_16,double Ad_24,double Ad_32,double Ad_40,color A_color_48) { if(Ad_16==Ad_24) A_color_48=Gray; ObjectSet("B"+As_0,OBJPROP_TIME1,A_datetime_8); ObjectSet("B"+As_0,OBJPROP_PRICE1,Ad_16); ObjectSet("B"+As_0,OBJPROP_TIME2,A_datetime_12); ObjectSet("B"+As_0,OBJPROP_PRICE2,Ad_24); ObjectSet("B"+As_0,OBJPROP_BACK,TRUE); ObjectSet("B"+As_0,OBJPROP_COLOR,A_color_48); int datetime_52=A_datetime_8+(A_datetime_12-A_datetime_8)/2; ObjectSet("S"+As_0,OBJPROP_TIME1,datetime_52); ObjectSet("S"+As_0,OBJPROP_PRICE1,Ad_32); ObjectSet("S"+As_0,OBJPROP_TIME2,datetime_52); ObjectSet("S"+As_0,OBJPROP_PRICE2,Ad_40); ObjectSet("S"+As_0,OBJPROP_BACK,TRUE); ObjectSet("S"+As_0,OBJPROP_WIDTH,2); ObjectSet("S"+As_0,OBJPROP_COLOR,A_color_48); } // CDF7118C61A4AA4E389CF2547874D314 void f0_7() { double Ld_0=(Ask-Bid)/Gd_420; string text_8="Spread: "+DoubleToStr(Ld_0,1)+" pips"; if(ObjectFind(G_name_412)<0) { ObjectCreate(G_name_412,OBJ_LABEL,0,0,0); ObjectSet(G_name_412,OBJPROP_CORNER,1); ObjectSet(G_name_412,OBJPROP_YDISTANCE,260); ObjectSet(G_name_412,OBJPROP_XDISTANCE,10); ObjectSetText(G_name_412,text_8,13,"Arial",G_color_408); } ObjectSetText(G_name_412,text_8); WindowRedraw(); } // 39C409D2E4985FE63B2929843BE560CF void f0_3() { int Li_8=Time[0]+60Period()-TimeCurrent(); double Ld_0=Li_8/60.0; int Li_12=Li_8%60; Li_8=(Li_8-Li_8%60)/60; Comment(Li_8+" minutes "+Li_12+" seconds left to bar end"); ObjectDelete("time"); if(ObjectFind("time")!=0) { ObjectCreate("time",OBJ_TEXT,0,Time[0],Close[0]+0.0005); ObjectSetText("time"," <--"+Li_8+":"+Li_12,13,"Verdana",Yellow); return; } ObjectMove("time",0,Time[0],Close[0]+0.0005); } // 0D09CCEE6F8BC2AF782594ED51D3E1A7 void f0_0() { int Li_0=iBarShift(NULL,PERIOD_D1,Time[0])+1; G_ihigh_444= iHigh(NULL,PERIOD_D1,Li_0); G_ilow_452 = iLow(NULL,PERIOD_D1,Li_0); G_datetime_468=iTime(NULL,PERIOD_D1,Li_0); if(TimeDayOfWeek(G_datetime_468)==0) { G_ihigh_444= MathMax(G_ihigh_444,iHigh(NULL,PERIOD_D1,Li_0+1)); G_ilow_452 = MathMin(G_ilow_452,iLow(NULL,PERIOD_D1,Li_0+1)); } Gd_460=G_ihigh_444-G_ilow_452; f0_1(); } // 177469F06A7487E6FDDCBE94FDB6FD63 int f0_1() { if(ObjectFind("FiboUp")==-1) ObjectCreate("FiboUp",OBJ_FIBO,0,G_datetime_468,G_ihigh_444+Gd_460,G_datetime_468,G_ihigh_444); else { ObjectSet("FiboUp",OBJPROP_TIME2,G_datetime_468); ObjectSet("FiboUp",OBJPROP_TIME1,G_datetime_468); ObjectSet("FiboUp",OBJPROP_PRICE1,G_ihigh_444+Gd_460); ObjectSet("FiboUp",OBJPROP_PRICE2,G_ihigh_444); } ObjectSet("FiboUp",OBJPROP_LEVELCOLOR,G_color_428); ObjectSet("FiboUp",OBJPROP_FIBOLEVELS,13); ObjectSet("FiboUp",OBJPROP_FIRSTLEVEL,0.0); ObjectSetFiboDescription("FiboUp",0,"(100.0%) - %"); ObjectSet("FiboUp",212,0.382); ObjectSetFiboDescription("FiboUp",2,"(138.2%) - %"); ObjectSet("FiboUp",214,0.618); ObjectSetFiboDescription("FiboUp",4,"(161.8%) - %"); ObjectSet("FiboUp",216,1.0); ObjectSetFiboDescription("FiboUp",6,"(200.0%) - %"); ObjectSet("FiboUp",218,1.5); ObjectSetFiboDescription("FiboUp",8,"(250.0%) - %"); ObjectSet("FiboUp",220,2.0); ObjectSetFiboDescription("FiboUp",10,"(300.0%) - %"); ObjectSet("FiboUp",222,3.0); ObjectSetFiboDescription("FiboUp",12,"(400.0%) - %"); ObjectSet("FiboUp",224,4.0); ObjectSetFiboDescription("FiboUp",14,"(500.0%) - %"); ObjectSet("FiboDn",211,0.236); ObjectSetFiboDescription("FiboDn",1,"(-23.6%) - %"); ObjectSet("FiboDn",213,0.5); ObjectSetFiboDescription("FiboDn",3,"(-50.0%) - %"); ObjectSet("FiboDn",215,0.764); ObjectSetFiboDescription("FiboDn",5,"(-76.4%) - %"); ObjectSet("FiboDn",217,1.236); ObjectSetFiboDescription("FiboDn",7,"(-123.6%) - %"); ObjectSet("FiboDn",219,1.5); ObjectSetFiboDescription("FiboDn",9,"(-150.0%) - %"); ObjectSet("FiboDn",221,1.764); ObjectSetFiboDescription("FiboDn",11,"(-176.4%) - %"); ObjectSet("FiboDn",223,2.5); ObjectSetFiboDescription("FiboDn",13,"(-250.0%) - %"); ObjectSet("FiboDn",225,3.5); ObjectSetFiboDescription("FiboDn",15,"(-350.0%) - %"); ObjectSet("FiboDn",227,4.5); ObjectSetFiboDescription("FiboDn",17,"(-450.0%) - %"); ObjectSet("FiboDn",OBJPROP_RAY,TRUE); ObjectSet("FiboDn",OBJPROP_BACK,TRUE); if(Gi_440) { if(ObjectFind("FiboIn")==-1) ObjectCreate("FiboIn",OBJ_FIBO,0,G_datetime_468,G_ihigh_444,G_datetime_468+86400,G_ilow_452); else { ObjectSet("FiboIn",OBJPROP_TIME2,G_datetime_468); ObjectSet("FiboIn",OBJPROP_TIME1,G_datetime_468+86400); ObjectSet("FiboIn",OBJPROP_PRICE1,G_ihigh_444); ObjectSet("FiboIn",OBJPROP_PRICE2,G_ilow_452); } ObjectSet("FiboIn",OBJPROP_LEVELCOLOR,G_color_432); ObjectSet("FiboIn",OBJPROP_FIBOLEVELS,7); ObjectSet("FiboIn",OBJPROP_FIRSTLEVEL,0.0); ObjectSetFiboDescription("FiboIn",0,"Daily LOW (0.0) - %"); ObjectSet("FiboIn",212,0.382); ObjectSetFiboDescription("FiboIn",2,"(38.2) - %"); ObjectSet("FiboIn",214,0.618); ObjectSetFiboDescription("FiboIn",4,"(61.8) - %"); ObjectSet("FiboIn",216,1.0); ObjectSetFiboDescription("FiboIn",6,"Daily HIGH (100.0) - %$"); ObjectSet("FiboIn",OBJPROP_RAY,TRUE); ObjectSet("FiboIn",OBJPROP_BACK,TRUE); } else ObjectDelete("FiboIn"); return (0); } //+------------------------------------------------------------------+
- Assistant
Il codice che hai fornito sembra essere un Expert Advisor (EA) scritto per MetaTrader 4 (MT4) utilizzando il linguaggio di programmazione MQL4. Non è del tutto chiaro se stai chiedendo una revisione del codice per eventuali errori di logica, sintassi o altri problemi, o se stai chiedendo qualcosa di specifico su una parte del codice.
Tuttavia, posso fornirti alcune indicazioni generali relative al codice che ho osservato:
-
Commenti iniziali - La sezione iniziale del codice sembra essere un commento di intestazione standard che include informazioni sul progetto, l'autore e l'URL dell'azienda. Non vi sono errori qui, purché le informazioni fornite siano corrette.
-
Variabili globali - Si utilizzano diverse variabili globali. Mentre questo non è necessariamente un errore, l'uso eccessivo delle variabili globali può rendere il codice più difficile da mantenere e può produrre effetti collaterali indesiderati. Considera l'utilizzo di variabili locali ove possibile e appropriato.
-
Nome delle variabili - Le variabili globali
Gi_180,G_pips_184,G_digits_192, ecc., non hanno nomi descrittivi. Questo rende il codice difficile da leggere e da comprendere. Dovresti utilizzare nomi di variabili che esprimono chiaramente lo scopo della variabile. -
Funzioni e Logica - Il codice contiene diverse funzioni (
init,deinit,start, etc.) e molti blocchi di logica. Senza un contesto più ampio, è difficile determinare se ci sono errori logici nel codice. La logica affida molto al contesto all'interno del quale viene eseguita. -
Commenti e debug - Ci sono istruzioni
Printutilizzate per il debug. Assicurati di rimuoverle o di commentarle quando l'EA è in produzione, poiché possono rallentare l'esecuzione e occupare spazio nei log. -
Error handling – L’EA contiene alcune chiamate a
OrderModifyeOrderSendseguite immediatamente da controllo degli errori. Questo è buono, ma alcune parti del codice hanno espressioniifvuote o bloccate con commenti. Assicurati che l'EA gestisca tutti i casi d'errore. -
Codice non utilizzato o morto - Ci sono alcuni blocchi (es.
Gs_unused_316,Gs_unused_324) e parti di codice che sembrano non essere utilizzati o commentati. Questi dovrebbero essere rimossi o chiariti prima di finalizzare l'EA. -
Stile e formattazione - Il codice varia nella formattazione, con alcuni commenti in italiano e altri in una lingua diversa. Un approccio coerente alla formattazione e allo stile del codice aiuterà a mantenere la leggibilità e la manutenibilità.
Per una recensione completa e per trovarvi degli errori, il codice avrebbe bisogno di essere ispezionato in un contesto più ampio, considerando ciò che l'EA è appunto progettato per fare. Inoltre, sarebbe utile eseguire test approfonditi su un ambiente di test MT4 per identificare qualsiasi problema di runtime o logica di trading.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.