Sorry while I was starting - hit the wrong button.
Anyway I have 2 problems that has me stuck can really use some help.
1) I put print statements in my code to tell me if it is progressing and to show info.
The tester is trading but my print statements are not showing the progression of the running code
only one print shows in the jounal tab; again it trades the one indicator.
2) I have another indicator from code base that after tinkering,I cant get the Icustom to show values.
This is indicator 2 ; Please can really use some help here is the code.
//+------------------------------------------------------------------+ //| RAYS-Step_Ma.mq4 | //| Copyright 2013, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright 2013, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #include <stderror.mqh> #define MagicNumber 155533 //+------------------------------------------------------------------+ //| Global Variables / Includes | //+------------------------------------------------------------------+ datetime CurrTime = 0; datetime PrevTime = 0; string Sym = ""; int TimeFrame = 0; int Shift = 1; //+------------------------------------------------------------------+ //| Expert User Inputs | //+------------------------------------------------------------------+ extern double MaximumRisk = 0.1; extern double DecreaseFactor = 0.02; extern bool UseCompletedBars = true; extern double lot, Lots = 0.1; extern int ProfitTarget = 0; extern int StopLoss = 0; extern int Slippage = 3; //+------------------------------------------------------------------+ int EMAPeriod = 12; int ERangePeriod = 8; int ERangeWindow = 5; // Must be less then ERangePeriod, think of it as custom TF // string AppliedPriceText1 = "Close: 0, Open: 1, High: 2, Low: 3"; // string AppliedPriceText2 = "Median: 4, Typical: 5, Weighted: 6"; int AppliedPrice = 4; int PriceShift = 0, RealTime = 1; double Period2 ,Dev2 ,Stp2; double Period3 ,Dev3 ,Stp3; // double Dev_Step_2 ; // double Dev_Step_3 ; extern string Dev_Step_2="8,5"; extern string Dev_Step_3="21,12"; double zzUp2, zzDw2, zzUp3, zzDw3; double indDw, indUp; double SymPoints , SymDigits; //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- Sym = Symbol(); TimeFrame = Period(); SymPoints = MarketInfo( Sym, MODE_POINT ); SymDigits = MarketInfo( Sym, MODE_DIGITS ); //--- if( SymPoints == 0.001 ) { SymPoints = 0.01; SymDigits = 3; } else if( SymPoints == 0.00001 ) { SymPoints = 0.0001; SymDigits = 5; } //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //------ Print( " got here ", UseCompletedBars ); /* RealTime = 0; if( UseCompletedBars ) { CurrTime = Time[0]; if( CurrTime == PrevTime ) { Print( " aa got here curr= ", CurrTime," prev= ", PrevTime ); return(0); Print( " bb */ RealTime = 0; if( UseCompletedBars ){ int f_New_Timem; bool f_New_Barm = false; static datetime New_Timem; if ( New_Timem!=Time[0] ) { New_Timem = Time[0]; f_New_Barm=true; RealTime = 1; } Print( " got here f_New_Barm== ", f_New_Barm," RealTime ",RealTime ); if ( f_New_Barm== false ){ return;} } //-------------- Update Vars CheckForClose(); indUp = 0.0 ; indDw = 0.0; Print( " 2 got here "); LotsOptimized(); Print( " 3 got here "); //------- Need to check for a new Signal? if( CountAll( Sym, MagicNumber) == 0) { // if (Period1>0) CountZZ(FP_BuferUp,FP_BuferDn,Period1,Dev1,Stp1); // if (Period2>0) CountZZ(NP_BuferUp,NP_BuferDn,Period2,Dev2,Stp2); // if (Period3>0) CountZZ(HP_BuferUp,HP_BuferDn,Period3,Dev3,Stp3); indUp = iCustom(NULL,0,"Step_EMA_LK",EMAPeriod, ERangePeriod ,ERangeWindow ,AppliedPrice ,0,0+RealTime); indDw = iCustom(NULL,0,"Step_EMA_LK",EMAPeriod, ERangePeriod ,ERangeWindow ,AppliedPrice ,1,0+RealTime); zzUp2 = iCustom(NULL,0,"3_Level_ZZ_Semafor",Period2 ,Dev_Step_2 ,2,0+RealTime); zzDw2 = iCustom(NULL,0,"3_Level_ZZ_Semafor",Period2 ,Dev_Step_2 ,3,0+RealTime); zzUp3 = iCustom(NULL,0,"3_Level_ZZ_Semafor",Period3 ,Dev_Step_3 ,4,0+RealTime); zzDw3 = iCustom(NULL,0,"3_Level_ZZ_Semafor",Period3 ,Dev_Step_3 ,5,0+RealTime); Print( " 4 Rays Step Ema indUp = ",indUp," indDw = ",indDw ); Print( " ** 3_Level zzUp2 = ",zzUp2 ); Print( " ** 3_Level zzDw2 = ",zzDw2 ); Print( " ** 3_Level zzUp3 = ",zzUp3 ); Print( " ** 3_Level zzDw3 = ",zzDw3 ); if ( indUp >0.0 && indUp < 500.0 && indUp!= indDw ) { indUp = 2.0; indDw = 0.0; } if ( indDw >0.0 && indDw < 500.0 && indUp!= indDw ) { indDw = 2.0; indUp = 0.0; } if( indUp > 0.0 ) { EnterLong(Sym, Lots, "");} else if( indDw > 0.0 ) { EnterShrt(Sym, Lots, "");} } //---- //---- return(0); } //+------------------------------------------------------------------+ //| Check For Close Functions | //+------------------------------------------------------------------+ void CheckForClose() { //------- get signal values indUp = iCustom(NULL,0,"Step_EMA_LK",EMAPeriod, ERangePeriod ,ERangeWindow ,AppliedPrice ,0,0+RealTime); indDw = iCustom(NULL,0,"Step_EMA_LK",EMAPeriod, ERangePeriod ,ERangeWindow ,AppliedPrice ,1,0+RealTime); //------- for ( int i = OrdersTotal() - 1; i >= 0; i-- ) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break; if(OrderMagicNumber()!= MagicNumber || OrderSymbol()!=Symbol()) continue; //---- check order type if( OrderType()==OP_BUY ) { if( indUp > 500.0 ) OrderClose(OrderTicket(),OrderLots(),Bid,3,White); break; } if( OrderType()==OP_SELL ) { if( indDw > 500.0 ) OrderClose(OrderTicket(),OrderLots(),Ask,3,White); break; } } return; }
2nd part.
//+------------------------------------------------------------------+ //| Calculate optimal lot size | //+------------------------------------------------------------------+ double LotsOptimized() { lot = Lots; int orders = HistoryTotal(); // history orders total int losses = 0; // number of losses orders without a break //---- select lot size lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1); //---- calcuulate number of losses orders without a break if(DecreaseFactor>0) { for(int i=orders-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; } if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue; //--------------- if(OrderProfit()>0) break; if(OrderProfit()<0) losses++; } if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1); } //------------------ return lot size if(lot<0.1) lot=0.1; return(lot); } //+------------------------------------------------------------------+ // CountAll() //+------------------------------------------------------------------+ int CountAll( string Symbole, int Magic ) { //---- int count = 0; for (int i = OrdersTotal() - 1; i >= 0; i--) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if ( OrderMagicNumber() != Magic ) continue; if ( OrderSymbol() != Symbole ) continue; if ( OrderType() == OP_BUY ) { count++; } else if ( OrderType() == OP_SELL ) { count++; } } //---- return(count); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Calculate Stop Long | //+------------------------------------------------------------------+ double StopLong(double price,double stop,double point,double SymDgts ) { if(stop==0) { return(0); } else { return(NormalizeDouble( price-(stop*point),SymDgts)); } } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Calculate Stop Short | //+------------------------------------------------------------------+ double StopShrt(double price,double stop,double point,double SymDgts ) { if(stop==0) { return(0); } else { return(NormalizeDouble( price+(stop*point),SymDgts)); } } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Calculate Profit Target Long | //+------------------------------------------------------------------+ double TakeLong(double price,double take,double point,double SymDgts ) { if(take==0) { return(0);} else { return(NormalizeDouble( price+(take*point),SymDgts));} } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Calculate Profit Target Long | //+------------------------------------------------------------------+ double TakeShrt(double price,double take,double point,double SymDgts ) { if(take==0) { return(0);} else { return(NormalizeDouble( price-(take*point),SymDgts));} } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Place Long Order | //+------------------------------------------------------------------+ int EnterLong( string FinalSymbol, double FinalLots, string EA_Comment ) { int Ticket = -1; int err = 0; bool OrderLoop = False; int TryCount = 0; while( !OrderLoop ) { while( IsTradeContextBusy() ) { Sleep( 10 ); } RefreshRates(); double SymAsk = NormalizeDouble( MarketInfo( FinalSymbol, MODE_ASK ), SymDigits ); double SymBid = NormalizeDouble( MarketInfo( FinalSymbol, MODE_BID ), SymDigits ); Ticket = OrderSend( FinalSymbol, OP_BUY, FinalLots, SymAsk, 0, 0.0, 0.0, EA_Comment, MagicNumber, 0, CLR_NONE ); int Err=GetLastError(); switch (Err) { //---- Success case ERR_NO_ERROR: OrderLoop = true; if( OrderSelect( Ticket, SELECT_BY_TICKET ) ) { OrderModify( Ticket, OrderOpenPrice(), StopLong(SymBid,StopLoss, SymPoints,SymDigits), TakeLong(SymAsk,ProfitTarget,SymPoints,SymDigits), 0, CLR_NONE ); } break; //---- Retry Error case ERR_SERVER_BUSY: case ERR_NO_CONNECTION: case ERR_INVALID_PRICE: case ERR_OFF_QUOTES: case ERR_BROKER_BUSY: case ERR_TRADE_CONTEXT_BUSY: TryCount++; break; case ERR_PRICE_CHANGED: case ERR_REQUOTE: continue; //---- Fatal known Error case ERR_INVALID_STOPS: OrderLoop = true; Print( "Invalid Stops" ); break; case ERR_INVALID_TRADE_VOLUME: OrderLoop = true; Print( "Invalid Lots" ); break; case ERR_MARKET_CLOSED: OrderLoop = true; Print( "Market Close" ); break; case ERR_TRADE_DISABLED: OrderLoop = true; Print( "Trades Disabled" ); break; case ERR_NOT_ENOUGH_MONEY: OrderLoop = true; Print( "Not Enough Money" ); break; case ERR_TRADE_TOO_MANY_ORDERS: OrderLoop = true; Print( "Too Many Orders" ); break; //---- Fatal Unknown Error case ERR_NO_RESULT: default: OrderLoop = true; Print( "Unknown Error - " + Err ); break; //---- } // end switch if( TryCount > 10) { OrderLoop = true; } } //---- return(Ticket); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Place Shrt Order | //+------------------------------------------------------------------+ int EnterShrt( string FinalSymbol, double FinalLots, string EA_Comment ) { int Ticket = -1; int err = 0; bool OrderLoop = False; int TryCount = 0; while( !OrderLoop ) { while( IsTradeContextBusy() ) { Sleep( 10 ); } RefreshRates(); double SymAsk = NormalizeDouble( MarketInfo( FinalSymbol, MODE_ASK ), SymDigits ); double SymBid = NormalizeDouble( MarketInfo( FinalSymbol, MODE_BID ), SymDigits ); Ticket = OrderSend( FinalSymbol, OP_SELL, FinalLots, SymBid, 0, 0.0, 0.0, EA_Comment, MagicNumber, 0, CLR_NONE ); int Err=GetLastError(); switch (Err) { //---- Success case ERR_NO_ERROR: OrderLoop = true; if( OrderSelect( Ticket, SELECT_BY_TICKET ) ) { OrderModify( Ticket, OrderOpenPrice(), StopShrt(SymAsk,StopLoss, SymPoints,SymDigits), TakeShrt(SymBid,ProfitTarget, SymPoints,SymDigits), 0, CLR_NONE ); } break; //---- Retry Error case ERR_SERVER_BUSY: case ERR_NO_CONNECTION: case ERR_INVALID_PRICE: case ERR_OFF_QUOTES: case ERR_BROKER_BUSY: case ERR_TRADE_CONTEXT_BUSY: TryCount++; break; case ERR_PRICE_CHANGED: case ERR_REQUOTE: continue; //---- Fatal known Error case ERR_INVALID_STOPS: OrderLoop = true; Print( "Invalid Stops" ); break; case ERR_INVALID_TRADE_VOLUME: OrderLoop = true; Print( "Invalid Lots" ); break; case ERR_MARKET_CLOSED: OrderLoop = true; Print( "Market Close" ); break; case ERR_TRADE_DISABLED: OrderLoop = true; Print( "Trades Disabled" ); break; case ERR_NOT_ENOUGH_MONEY: OrderLoop = true; Print( "Not Enough Money" ); break; case ERR_TRADE_TOO_MANY_ORDERS: OrderLoop = true; Print( "Too Many Orders" ); break; //---- Fatal Unknown Error case ERR_NO_RESULT: default: OrderLoop = true; Print( "Unknown Error - " + Err ); break; //---- } // end switch if( TryCount > 10) { OrderLoop = true; } } //---- return(Ticket); }
I
//+------------------------------------------------------------------+ //| Step_EMA_LK.mq4 | //| Copyright © 2009, Leif Karlsson. | //| Leffemannen1973@telia.com | //+------------------------------------------------------------------+ //| Please feel free to copy, modify and / or redistribute this | //| software / source code in any way you see fit. | //+------------------------------------------------------------------+ //+ ********************* Shameless Ad. **************************** + //+ * I do custom programing jobs in Java, C, X86 Assembler & MQL4 * + //+ ***** Pleace do not hesitate to get in contact if you nead ***** + //+ ***** something special: EA, indicator or somthing else. ******* + //+ ****************** Leffemannen1973@telia.com ******************* + //+ **************************************************************** + //+------------------------------------------------------------------+ #property copyright "Copyright © 2009, Leif Kalrsson" #property link "mailto://Leffemannen1973@telia.com" //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Yellow #property indicator_color2 Red #property indicator_width1 1 //+------------------------------------------------------------------+ extern int EMAPeriod = 15; extern int ERangePeriod = 12; extern int ERangeWindow = 5; // Must be less then ERangePeriod, think of it as custom TF extern string AppliedPriceText1 = "Close: 0, Open: 1, High: 2, Low: 3"; extern string AppliedPriceText2 = "Median: 4, Typical: 5, Weighted: 6"; extern int AppliedPrice = 4; extern int PriceShift = 0; extern int MaxBars = 4000; //+------------------------------------------------------------------+ double UpBuffer[]; double DwBuffer[]; double Price[]; double ERange[]; double EmaAlpha = 0.0; double ERangeAlpha = 0.0; //+------------------------------------------------------------------+ int init() { IndicatorDigits(Digits+1); IndicatorBuffers(4); SetIndexStyle(0, DRAW_LINE); SetIndexStyle(1, DRAW_LINE); SetIndexBuffer(0, UpBuffer); SetIndexBuffer(1, DwBuffer); SetIndexBuffer(2, Price); SetIndexBuffer(3, ERange); IndicatorShortName("Step_EMA, EMAPeriod: " + EMAPeriod + ", ERangePeriod: " + ERangePeriod + " "); EmaAlpha = 2.0/(EMAPeriod + 1.0); ERangeAlpha = 2.0/(ERangePeriod + 1.0); Print( " WindowExpertName() ", WindowExpertName()) ; return(0); } //+------------------------------------------------------------------+ int start() { int j = 0; int i = IndicatorCounted(); if(i < 0) return(-1); i = Bars - i; if(i > MaxBars) { i = MaxBars; ArrayInitialize(UpBuffer, EMPTY_VALUE); ArrayInitialize(DwBuffer, EMPTY_VALUE); ArrayInitialize(ERange, High[i]-Low[i]); } j = i; while(j >= 0) { Price[j] = iMA(NULL, 0, 1, 0, 0, AppliedPrice, j+PriceShift); j--; } while(i >= 0) { /* int f_New_Time,NewBar; bool f_New_Bar = false; static datetime New_Time; if (New_Time!=Time[0]) { New_Time = Time[0]; f_New_Bar=true; } if (f_New_Bar==true){ if ( UpBuffer[i]!= EMPTY_VALUE ) { Print( " WindowExpertName() ",WindowExpertName()," UpBuffer = ",UpBuffer[i]); } if ( DwBuffer[i]!= EMPTY_VALUE ) { Print( " WindowExpertName() ",WindowExpertName()," DwBuffer = ",DwBuffer[i]); } } */ // Print( " WindowExpertName() ",WindowExpertName()," UpBuffer = ",UpBuffer[i]," DwBuffer = ",DwBuffer[i] ); if ( UpBuffer[i]!= EMPTY_VALUE ) { Print( " UpBuffer = ",UpBuffer[i]); } if ( DwBuffer[i]!= EMPTY_VALUE ) { Print( " DwBuffer = ",DwBuffer[i]); } double Range = 0.0; double StepSize = 0.0; double SEma = 0.0; double OldSEma = 0.0; Range = High[ArrayMaximum(High, ERangeWindow, i+PriceShift+1)] - Low[ArrayMinimum(Low, ERangeWindow, i+PriceShift+1)]; ERange[i] = (1.0-ERangeAlpha)*ERange[i+1] + ERangeAlpha*Range; StepSize = ERange[i]; if(UpBuffer[i+1] != EMPTY_VALUE) SEma = (1.0-EmaAlpha)*UpBuffer[i+1] + EmaAlpha*Price[i]; if(DwBuffer[i+1] != EMPTY_VALUE) SEma = (1.0-EmaAlpha)*DwBuffer[i+1] + EmaAlpha*Price[i]; if(SEma == 0.0) SEma = Price[i]; if(SEma < Price[i]-StepSize) SEma = Price[i]-StepSize; if(SEma > Price[i]+StepSize) SEma = Price[i]+StepSize; if(UpBuffer[i+1] == EMPTY_VALUE) OldSEma = DwBuffer[i+1]; else OldSEma = UpBuffer[i+1]; if(SEma > OldSEma) { UpBuffer[i] = SEma; DwBuffer[i] = EMPTY_VALUE; if(UpBuffer[i+1] == EMPTY_VALUE) UpBuffer[i+1] = OldSEma; } else { DwBuffer[i] = SEma; UpBuffer[i] = EMPTY_VALUE; if(DwBuffer[i+1] == EMPTY_VALUE) DwBuffer[i+1] = OldSEma; } i--; } return(0); }
ndiators
2nd indicator the one not getting buffer values
//+------------------------------------------------------------------+ //| 3_Level_ZZ_Semafor.mq4 | //+------------------------------------------------------------------+ #property copyright "asystem2000" #property link "asystem2000@yandex.ru" //----------------- #property indicator_chart_window #property indicator_buffers 6 #property indicator_color1 Chocolate #property indicator_color2 Chocolate #property indicator_color3 HotPink #property indicator_color4 HotPink #property indicator_color5 Yellow #property indicator_color6 Yellow //---- input parameters extern double Period1=5; extern double Period2=13; extern double Period3=34; extern string Dev_Step_1="1,3"; extern string Dev_Step_2="8,5"; extern string Dev_Step_3="21,12"; extern int Symbol_1_Kod=140; extern int Symbol_2_Kod=141; extern int Symbol_3_Kod=142; //---- buffers double FP_BuferUp[]; double FP_BuferDn[]; double NP_BuferUp[]; double NP_BuferDn[]; double HP_BuferUp[]; double HP_BuferDn[]; int F_Period; int N_Period; int H_Period; int Dev1; int Stp1; int Dev2; int Stp2; int Dev3; int Stp3; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { // --------- if (Period1>0) F_Period=MathCeil(Period1*Period()); else F_Period=0; if (Period2>0) N_Period=MathCeil(Period2*Period()); else N_Period=0; if (Period3>0) H_Period=MathCeil(Period3*Period()); else H_Period=0; //---- if (Period1>0) { SetIndexStyle(0,DRAW_ARROW,0,1); SetIndexArrow(0,Symbol_1_Kod); SetIndexBuffer(0,FP_BuferUp); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW,0,1); SetIndexArrow(1,Symbol_1_Kod); SetIndexBuffer(1,FP_BuferDn); SetIndexEmptyValue(1,0.0); } //---- if (Period2>0) { SetIndexStyle(2,DRAW_ARROW,0,2); SetIndexArrow(2,Symbol_2_Kod); SetIndexBuffer(2,NP_BuferUp); SetIndexEmptyValue(2,0.0); SetIndexStyle(3,DRAW_ARROW,0,2); SetIndexArrow(3,Symbol_2_Kod); SetIndexBuffer(3,NP_BuferDn); SetIndexEmptyValue(3,0.0); } //---- if (Period3>0) { SetIndexStyle(4,DRAW_ARROW,0,4); SetIndexArrow(4,Symbol_3_Kod); SetIndexBuffer(4,HP_BuferUp); SetIndexEmptyValue(4,0.0); SetIndexStyle(5,DRAW_ARROW,0,4); SetIndexArrow(5,Symbol_3_Kod); SetIndexBuffer(5,HP_BuferDn); SetIndexEmptyValue(5,0.0); } // ---- int CDev=0; int CSt=0; int Mass[]; int C=0; if (IntFromStr(Dev_Step_1,C, Mass)==1) { Stp1=Mass[1]; Dev1=Mass[0]; } if (IntFromStr(Dev_Step_2,C, Mass)==1) { Stp2=Mass[1]; Dev2=Mass[0]; } if (IntFromStr(Dev_Step_3,C, Mass)==1) { Stp3=Mass[1]; Dev3=Mass[0]; } return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { if (Period1>0) CountZZ(FP_BuferUp,FP_BuferDn,Period1,Dev1,Stp1); if (Period2>0) CountZZ(NP_BuferUp,NP_BuferDn,Period2,Dev2,Stp2); if (Period3>0) CountZZ(HP_BuferUp,HP_BuferDn,Period3,Dev3,Stp3); return(0); } //+------------------------------------------------------------------+ //-------------------------------------------------------------------+ //int Take //+------------------------------------------------------------------+ //| //+------------------------------------------------------------------+ int CountZZ( double& ExtMapBuffer[], double& ExtMapBuffer2[], int ExtDepth, int ExtDeviation, int ExtBackstep ) { int shift, back,lasthighpos,lastlowpos; double val,res; double curlow,curhigh,lasthigh,lastlow; for(shift=Bars-ExtDepth; shift>=0; shift--) { val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)]; if(val==lastlow) val=0.0; else { lastlow=val; if((Low[shift]-val)>(ExtDeviation*Point)) val=0.0; else { for(back=1; back<=ExtBackstep; back++) { res=ExtMapBuffer[shift+back]; if((res!=0)&&(res>val)) ExtMapBuffer[shift+back]=0.0; } } } ExtMapBuffer[shift]=val; //--- high val=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)]; if(val==lasthigh) val=0.0; else { lasthigh=val; if((val-High[shift])>(ExtDeviation*Point)) val=0.0; else { for(back=1; back<=ExtBackstep; back++) { res=ExtMapBuffer2[shift+back]; if((res!=0)&&(res<val)) ExtMapBuffer2[shift+back]=0.0; } } } ExtMapBuffer2[shift]=val; } // final cutting lasthigh=-1; lasthighpos=-1; lastlow=-1; lastlowpos=-1; for(shift=Bars-ExtDepth; shift>=0; shift--) { curlow=ExtMapBuffer[shift]; curhigh=ExtMapBuffer2[shift]; if((curlow==0)&&(curhigh==0)) continue; //--- if(curhigh!=0) { if(lasthigh>0) { if(lasthigh<curhigh) ExtMapBuffer2[lasthighpos]=0; else ExtMapBuffer2[shift]=0; } //--- if(lasthigh<curhigh || lasthigh<0) { lasthigh=curhigh; lasthighpos=shift; } lastlow=-1; } //---- if(curlow!=0) { if(lastlow>0) { if(lastlow>curlow) ExtMapBuffer[lastlowpos]=0; else ExtMapBuffer[shift]=0; } //--- if((curlow<lastlow)||(lastlow<0)) { lastlow=curlow; lastlowpos=shift; } lasthigh=-1; } } for(shift=Bars-1; shift>=0; shift--) { if(shift>=Bars-ExtDepth) ExtMapBuffer[shift]=0.0; else { res=ExtMapBuffer2[shift]; if(res!=0.0) ExtMapBuffer2[shift]=res; } } } int Str2Massive(string VStr, int& M_Count, int& VMass[]) { int val=StrToInteger( VStr); if (val>0) { M_Count++; int mc=ArrayResize(VMass,M_Count); if (mc==0)return(-1); VMass[M_Count-1]=val; return(1); } else return(0); } int IntFromStr(string ValStr,int& M_Count, int& VMass[]) { if (StringLen(ValStr)==0) return(-1); string SS=ValStr; int NP=0; string CS; M_Count=0; ArrayResize(VMass,M_Count); while (StringLen(SS)>0) { NP=StringFind(SS,","); if (NP>0) { CS=StringSubstr(SS,0,NP); SS=StringSubstr(SS,NP+1,StringLen(SS)); } else { if (StringLen(SS)>0) { CS=SS; SS=""; } } if (Str2Massive(CS,M_Count,VMass)==0) { return(-2); } } return(1); }
Sorry while I was starting - hit the wrong button.
Anyway I have 2 problems that has me stuck can really use some help.
1) I put print statements in my code to tell me if it is progressing and to show info.
The tester is trading but my print statements are not showing the progression of the running code
only one print shows in the jounal tab; again it trades the one indicator.
Did you check the log file ?
If what is referred to as log file is the expert tab, it does not update for strat - tester and if its another please show me where.
You know if I remove the new bar code all the print statements appear in the journal tab,it is confusing and the tester slows to a micro movement.
I check the new bar code looks good and comment out all but one print statement past new bar and
its the same it shows that there is no new bar but trades on new bar. I made up a small expert to test the new bar and the print stops at no new bar.
Here is test expert. Thanks for any help.
//+------------------------------------------------------------------+ //| rays tester.mq4 | //| Copyright 2013, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright 2013, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #include <stderror.mqh> #define MagicNumber 1555399 #define 3_Level_ZZ_Semafor "3_Level_ZZ_Semafor" //+------------------------------------------------------------------+ //| Global Variables / Includes | //+------------------------------------------------------------------+ datetime CurrTime = 0; datetime PrevTime = 0; string Sym = ""; int TimeFrame = 0; int Shift = 1; //+------------------------------------------------------------------+ //| Expert User Inputs | //+------------------------------------------------------------------+ extern double MaximumRisk = 0.1; extern double DecreaseFactor = 0.02; extern double lot, Lots = 0.1; extern int ProfitTarget = 0; extern int StopLoss = 0; extern int Slippage = 3; extern bool UseCompletedBars = true; //+------------------------------------------------------------------+ int PriceShift = 0, RealTime = 1; double Period2 ,Dev2 ,Stp2; double Period3 ,Dev3 ,Stp3; // double Dev_Step_2 ; // double Dev_Step_3 ; extern string Dev_Step_2="8,5"; extern string Dev_Step_3="21,12"; //int Symbol_2_Kod , Symbol_3_Kod; double zzUp2, zzDw2, zzUp3, zzDw3; double indDw, indUp; double SymPoints , SymDigits; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- Sym = Symbol(); TimeFrame = Period(); SymPoints = MarketInfo( Sym, MODE_POINT ); SymDigits = MarketInfo( Sym, MODE_DIGITS ); //--- if( SymPoints == 0.001 ) { SymPoints = 0.01; SymDigits = 3; } else if( SymPoints == 0.00001 ) { SymPoints = 0.0001; SymDigits = 5; } //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0);} //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- int RealTime = 0; if( UseCompletedBars ) { CurrTime = iTime(Sym, TimeFrame, 1 ); if( CurrTime == PrevTime ) { Print( "return got here ", UseCompletedBars," ", RealTime ); // only this no new Bar shows return(0); } //---- Update Vars PrevTime = CurrTime; RealTime = 1; } Print( " 1 got here ", UseCompletedBars," ", RealTime ); // does not show this zzUp2 = iCustom(NULL,0,"3_Level_ZZ_Semafor",Period2 ,Dev_Step_2 ,2,0+RealTime); zzDw2 = iCustom(NULL,0,"3_Level_ZZ_Semafor",Period2 ,Dev_Step_2 ,3,0+RealTime); zzUp3 = iCustom(NULL,0,"3_Level_ZZ_Semafor",Period3 ,Dev_Step_3 ,4,0+RealTime); zzDw3 = iCustom(NULL,0,"3_Level_ZZ_Semafor",Period3 ,Dev_Step_3 ,5,0+RealTime); // Print( " ** 3_Level zzUp2 = ",zzUp2 ); // Print( " ** 3_Level zzDw2 = ",zzDw2 ); // Print( " ** 3_Level zzUp3 = ",zzUp3 ); // Print( " ** 3_Level zzDw3 = ",zzDw3 ); //---- return(0); } //+------------------------------------------------------------------+
If what is referred to as log file is the expert tab, it does not update for strat - tester and if its another please show me where.
Well I opened the tester log file and got - this folder is empty.
I tried running the tester several times and same thing.
I don't know how to get this folder to update,any suggestion?
Well I opened the tester log file and got - this folder is empty.
I tried running the tester several times and same thing.
I don't know how to get this folder to update,any suggestion?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use