learning mql5

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
checking for proper alignment of 5, 10, 20, 200 smas and returning color......

trend type filter......h

//------

Code:
//------
//------

    for(int r = 0; r < ArraySize(tfs); r++)
      {

    int ma5[15];    
    int ma10[15];    
    int ma20[15];    
    int ma200[15];    
 

 

      ma5[r]      = iMA(symbol, tfs[r],5,0,MODE_SMA,PRICE_CLOSE);
      ma10[r]     = iMA(symbol, tfs[r],10,0,MODE_SMA,PRICE_CLOSE);
      ma20[r]     = iMA(symbol, tfs[r],20,0,MODE_SMA,PRICE_CLOSE);
      ma200[r]    = iMA(symbol, tfs[r],200,0,MODE_SMA,PRICE_CLOSE);



 
        double ma5s[];

        ArraySetAsSeries(ma5s,true);  

        CopyBuffer(ma5[r],0,0,4,ma5s);

 
        double ma10s[];

        ArraySetAsSeries(ma10s,true);  

        CopyBuffer(ma10[r],0,0,4,ma10s);

 
 
        double ma20s[];

        ArraySetAsSeries(ma20s,true);  

        CopyBuffer(ma20[r],0,0,4,ma20s);

 
        double ma200s[];

        ArraySetAsSeries(ma200s,true);  

        CopyBuffer(ma200[r],0,0,4,ma200s);

     


        clrmasalign[r]  = clrYellow;
       
        if(( (ma5s[0] > ma10s[0]) && (ma5s[0] > ma20s[0])  && (ma10s[0] > ma20s[0])  && (ma20s[0] > ma200s[0]) )  &&  ( (ma5s[0] > ma5s[1]) && (ma10s[0] > ma10s[1])  && (ma20s[0] > ma20s[1])  && (ma200s[0] > ma200s[1]) )  )    
         
           {
           clrmasalign[r] = clrBlue;
           }


        if( ( (ma5s[0] < ma10s[0]) && (ma5s[0] < ma20s[0])  && (ma10s[0] < ma20s[0])  && (ma20s[0] < ma200s[0]) )   &&  ( (ma5s[0] < ma5s[1]) && (ma10s[0] < ma10s[1])  && (ma20s[0] < ma20s[1])  && (ma200s[0] < ma200s[1]) )  )    
         
           {
           clrmasalign[r] = clrRed;
           }

      }

//------  
//------

//------

Screenshot 2024-11-29 032708.png
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
working on it......h

//------

history deal constants.....

datetime conversions.......

deal property string......

history deal get integer......



//--------

MQL5:
double orders[20][20];
 
string symbols[5] = {"YM", "ES", "NQ", "RT", "GC"};
 
 
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
 
 
void OnStart()
  {
//--- request all the existing history on the account
   if(!HistorySelect(0, TimeCurrent()))
     {
      Print("HistorySelect() failed. Error ", GetLastError());
      return;
     }
 
 
  uint     totals = HistoryDealsTotal();
 
  Print("Number of historical deals on the account: ", totals);
 
  string   symbol    = "";
  double   profit    =  0;
  ulong    ticket     = 0;
  datetime time;
 
  MqlDateTime structure;
 
//--- for all deals
   for(uint i=0;i<totals;i++)
     {
       if((ticket=HistoryDealGetTicket(i)) > 0 )
 
 
      symbol = StringSubstr(HistoryDealGetString(ticket,DEAL_SYMBOL), 0, 2);  // substring  needed due to contract months changing
 
      //Print(symbol);
 
        for(int j = 0; j< ArraySize(symbols); j++)
           {
           if(symbol == symbols[j])
            {
              orders[j][0] = orders[j][0] +1;
              orders[j][1] = orders[j][1] + HistoryDealGetDouble(ticket,DEAL_PROFIT);
              orders[j][2] = orders[j][2] + HistoryDealGetDouble(ticket, DEAL_VOLUME);  
              //orders[j][3] = orders[j][1] +
              //orders[j][4] = orders[j][1] +
              orders[j][5] = orders[j][5] + HistoryDealGetDouble(ticket, DEAL_COMMISSION);  
 
//-----                dayoftheweek  
 
              time =  HistoryDealGetInteger(ticket,DEAL_TIME);
 
              TimeToStruct(time, structure);
 
              int weekday = structure.day_of_week;  // Print(weekday);  //  Print(TimeToString(time, TIME_DATE));
 
              if(weekday == 1) {orders[j][11] = orders[j][11] + 1;  Print(symbols[j]+" monday orders "+orders[j][11]);}  
              if(weekday == 2) {orders[j][12] = orders[j][12] + 1;  Print(symbols[j]+" tuesday orders "+orders[j][12]);}
              if(weekday == 3) {orders[j][13] = orders[j][13] + 1;  Print(symbols[j]+" wednesday orders "+orders[j][13]);}
              if(weekday == 4) {orders[j][14] = orders[j][14] + 1;  Print(symbols[j]+" thursday orders "+orders[j][14]);}
              if(weekday == 5) {orders[j][15] = orders[j][15] + 1;  Print(symbols[j]+" friday orders "+orders[j][15]);}
//-----
 
           }
 
           }
 
 
      }
 
  Print("YM " +orders[0][0]+"  profit "+ orders[0][1] + "  ES " + orders[1][0]+"  profit "+ orders[1][1]  + "  NQ " +orders[2][0]+"  profit "+ orders[2][1]  + "  RTY " +orders[3][0]+"  profit "+ orders[3][1]  );  
 
  }
 
Last edited by a moderator:

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
Vladimir Karputov , aka barabashkakvn, from perhaps ukraine, posted on the mq5 site his Two MA Color N Bars Square - indicator for MetaTrader 5.......

this was something i had tried to do a few months ago, before finally setting it aside...... all it takes is a single concept error to end all hope.......

have written and posted hundreds or these type indicators for mq4....... they are useful to me.....

i modified , only slightly, his indicator to do what i could not before........ lines 75 and 90 in his code below......

his original is below,...... along with a hma(10) and hma(20)...... and alma and sma(200)...... you will need the alma and hma also..... will expand these.....

seems best to create a template......

the idea , for me, is small sized trades with prevailing trend....... h

//-----

he has a youtube channel...... some of his videos are translated in to english......


Screenshot 2024-12-27 062041.png
//-------
 

Attachments

  • Two MA Color N Bars Square.ex5
    19.3 KB · Views: 1
  • hma.mq5
    12.6 KB · Views: 1
  • hma.ex5
    14.4 KB · Views: 0
  • alma.mq5
    7.1 KB · Views: 1
  • alma.ex5
    9.4 KB · Views: 0
  • Two MA Color N Bars Square v alma sma200.mq5
    23.3 KB · Views: 1
  • Two MA Color N Bars Square v alma sma200.ex5
    19.9 KB · Views: 1
  • Two MA Color N Bars Square v hma10 hma20.mq5
    23.4 KB · Views: 1
  • Two MA Color N Bars Square v hma10 hma20.ex5
    19.6 KB · Views: 1
Last edited:
  • 👍
Reactions: Enivid

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
the coppock indicator was intended monthly charts...... few can trade monthly charts...... not me for sure......

it seems to work equally well for me on lower timeframes......

if you looked at the math, it's really just comparing 2 roc's, rate of changes, and the creating a moving average of that change......

a single ma applied to the roc indicator is a very close approximation of the coppock...... such a indicator is on the mq5 site......

roc with a signal ma.......

the idea for me with both the coppock and the roc with ma, is to alert on the zero line crossing....... a 0 line cross with confirming hull and alma ma's seems a fair signal.....

had to edit the roc with ma to work with the mym, dow 30, futures....... some indicators will not work well with symbols that are whole numbers only......

adjustable digits version below......h
//------

MYMH25M15 22.png

//-----
 

Attachments

  • ROC_with_Signal_MA digits.mq5
    9.1 KB · Views: 0
  • ROC_with_Signal_MA digits.ex5
    12.7 KB · Views: 0

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
archive.....h

//------

initial expert code......

//------

MQL5:
void OnTick()
  {
//---
 
//----
     double a = (GlobalVariableGet("MYMH251") + GlobalVariableGet("MYMH255") + GlobalVariableGet("MYMH2515") + GlobalVariableGet("MYMH2530") + GlobalVariableGet("MYMH2560") + GlobalVariableGet("MYMH25240") + GlobalVariableGet("MYMH251440"));
     double b = (GlobalVariableGet("MESH251") + GlobalVariableGet("MESH255") + GlobalVariableGet("MESH2515") + GlobalVariableGet("MESH2530") + GlobalVariableGet("MESH2560") + GlobalVariableGet("MESH25240") + GlobalVariableGet("MESH251440"));
     double c = (GlobalVariableGet("MNQH251") + GlobalVariableGet("MNQH255") + GlobalVariableGet("MNQH2515") + GlobalVariableGet("MNQH2530") + GlobalVariableGet("MNQH2560") + GlobalVariableGet("MNQH25240") + GlobalVariableGet("MNQH251440"));
     double d = (GlobalVariableGet("M2KH251") + GlobalVariableGet("M2KH255") + GlobalVariableGet("M2KH2515") + GlobalVariableGet("M2KH2530") + GlobalVariableGet("M2KH2560") + GlobalVariableGet("M2KH25240") + GlobalVariableGet("M2KH251440"));
 
     Comment("Alerts are "+alerts+ "     mym "+DoubleToString(a,0) +  "   mes "+DoubleToString(b,0) +  "   mmq "+DoubleToString(c,0) +  "   m2k "+DoubleToString(d,0));
 
    if(alerts)
    {
    if((GlobalVariableGet("MMYH251") + GlobalVariableGet("MMYH255") + GlobalVariableGet("MMYH2515") + GlobalVariableGet("MMYH2530") + GlobalVariableGet("MMYH2560") + GlobalVariableGet("MMYH25240") + GlobalVariableGet("MMYH251440"))  >=  60.0) {Alert(" MMY buy");}
    if((GlobalVariableGet("MMYH251") + GlobalVariableGet("MMYH255") + GlobalVariableGet("MMYH2515") + GlobalVariableGet("MMYH2530") + GlobalVariableGet("MMYH2560") + GlobalVariableGet("MMYH25240") + GlobalVariableGet("MMYH251440"))  <= -60.0) {Alert(" MMY sell");}
 
    if((GlobalVariableGet("MESH251") + GlobalVariableGet("MESH255") + GlobalVariableGet("MESH2515") + GlobalVariableGet("MESH2530") + GlobalVariableGet("MESH2560") + GlobalVariableGet("MESH25240") + GlobalVariableGet("MESH251440"))  >=  60.0) {Alert(" MES buy");}
    if((GlobalVariableGet("MESH251") + GlobalVariableGet("MESH255") + GlobalVariableGet("MESH2515") + GlobalVariableGet("MESH2530") + GlobalVariableGet("MESH2560") + GlobalVariableGet("MESH25240") + GlobalVariableGet("MESH251440"))  <= -60.0) {Alert(" MES sell");}
 
    if((GlobalVariableGet("MNQH251") + GlobalVariableGet("MNQH255") + GlobalVariableGet("MNQH2515") + GlobalVariableGet("MNQH2530") + GlobalVariableGet("MNQH2560") + GlobalVariableGet("MNQH25240") + GlobalVariableGet("MNQH251440"))  >=  60.0) {Alert(" MNQ buy");}
    if((GlobalVariableGet("MNQH251") + GlobalVariableGet("MNQH255") + GlobalVariableGet("MNQH2515") + GlobalVariableGet("MNQH2530") + GlobalVariableGet("MNQH2560") + GlobalVariableGet("MNQH25240") + GlobalVariableGet("MNQH251440"))  <= -60.0) {Alert(" MNQ sell");}
 
    if((GlobalVariableGet("M2KH251") + GlobalVariableGet("M2KH255") + GlobalVariableGet("M2KH2515") + GlobalVariableGet("M2KH2530") + GlobalVariableGet("M2KH2560") + GlobalVariableGet("M2KH25240") + GlobalVariableGet("M2KH251440"))  >=  60.0) {Alert(" M2K buy");}
    if((GlobalVariableGet("M2KH251") + GlobalVariableGet("M2KH255") + GlobalVariableGet("M2KH2515") + GlobalVariableGet("M2KH2530") + GlobalVariableGet("M2KH2560") + GlobalVariableGet("M2KH25240") + GlobalVariableGet("M2KH251440"))  <= -60.0) {Alert(" M2K sell");}
    }
 
  }
//+------------------------------------------------------------------+

//-----

//-----

initial companion indicator code.......

MQL5:
// alerts v3
//           if(run == false)
//            {
            if((almas[1] > almas[2]) && (hmas[1] > hmas[2]) && (coppocks[1] > coppocks[2]))  { clr[j] = clrBlue; GlobalVariableSet(_Symbol+tfs[j], 10); }  //Print(GlobalVariableGet(_Symbol+tfs[j]) +" b");
 
            if((almas[1] < almas[2]) && (hmas[1] < hmas[2]) && (coppocks[1] < coppocks[2]))  { clr[j] = clrRed;  GlobalVariableSet(_Symbol+tfs[j],-10); }  //Print(GlobalVariableGet(_Symbol+tfs[j]) +" s");
 
 
            if( !((almas[1] > almas[2]) && (hmas[1] > hmas[2]) && (coppocks[1] > coppocks[2])) && !((almas[1] < almas[2]) && (hmas[1] < hmas[2]) && (coppocks[1] < coppocks[2])))   {clr[j] = clrYellow;  GlobalVariableSet(_Symbol+tfs[j],0);}
 
//            }
 
//-----
 
 
           if((buy[j]  == false) &&  ((almas[1] > almas[2]) && (hmas[1] > hmas[2]) && (coppocks[1] > coppocks[2])))                 //  && (schaffs[1] > 0.20) &&   ((almas[2] < almas[3]) || (hmas[2] < hmas[3]) || (coppocks[2] < 0.0) || (schaffs[2] < 0.20) || (run == false)))  // || (run == false)
 
           {
           buy[j] = true;   sell[j] = false; //  clr[j] = clrBlue;  GlobalVariableSet(_Symbol+tfs[j],-1);     
 
 
           if((j == 1) || (j == 2) || (j == 3) || (j == 4))  {Alert(_Symbol + "  "+ tfs[j]+"  minute bullish change ");}
 
           }   
 
 
 
           if((sell[j] == false) &&  ((almas[1] < almas[2]) && (hmas[1] < hmas[2]) && (coppocks[1] < coppocks[2])))                 //  && (schaffs[1] < 0.96) &&   ((almas[2] > almas[3]) || (hmas[2] > hmas[3]) || (coppocks[2] > 0.0) || (schaffs[1] > 0.96) || (run == false)))  // || (run == false)
 
           {
           buy[j] = false;  sell[j] = true;  //clr[j] = clrRed; GlobalVariableSet(_Symbol+tfs[j],10);
 
 
           if((j == 1) || (j == 2) || (j == 3) || (j == 4))  {Alert(_Symbol + "  "+ tfs[j]+"  minute bearish change ");}
 
 
           }


//-----

Screenshot 2025-02-14 082330.png
Post automatically merged:

.....h

//-----

Screenshot 2025-02-14 140301.png
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
break operator.....

attempt at counting bars since last signal on tfs listed......h

//------

MQL5:
//---      count completed bars since last signal.....
 
 
           int a = 0;
           int b = 0;
 
 
           for(int k=0;k<15;k++)
              {
              if( ((almas[1+k] > almas[2+k]) && (hmas[1+k] > hmas[2+k]) && (coppocks[1+k] > coppocks[2+k])) )  {a++;} else break;
              }
 
           for(int l=0;l<15;l++)
              {             
              if( ((almas[1+l] < almas[2+l]) && (hmas[1+l] < hmas[2+l]) && (coppocks[1+l] < coppocks[2+l])) )  {b++;} else break;
              }
 
 
//---               Print(tfs[j] +" minutes aa = " +a);           //------ verified count 
 
//---               Print(tfs[j] +" minutes  bb = " +b);          //-----  verified count
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
market view arrangement using simple global variables..... blue buy..... red sell...... yellow coin toss.....
//-----


to do list....

1. code a price change since signal or group of signals..... such as since all 15's and 30's turned blue....

.....h


//-----

MQL5:
    for(int r = 0; r < 4; r++)                                //  string sym[4]          = {"MYMH25", "MESH25", "MNQH25", "M2KH25"};
      {
 
       Display(sym[r],  20, 200+(r*100));             
       ObjectSetText(sym[r], sym[r],10,"Verdana", clrAqua);
 
 
      for(int t = 0; t < 7; t++)                              //  string tfs[14]         = {"1", "5", "15", "30", "60", "240", "1440"}; 
      {
       color  clr    = clrYellow;
       string symbol = sym[r]+tfs[t];
 
       Display(tfs[t],  200+(t*100), 100);             
       ObjectSetText(tfs[t], tfs[t],10,"Verdana", clrAqua);
 
 
       if(GlobalVariableGet(symbol) ==  10) {clr = clrBlue;}
       if(GlobalVariableGet(symbol) == -10) {clr = clrRed;}
 
       Display(symbol,  200+(t*100), 200+(r*100));       //       Display(symbol,  20+(r*100), 100+(t*100)); 
 
       ObjectSetText(symbol, "ÛÛÛÛ",10,"Terminal", clr);
 
      }
      }

//-----
//-----

Screenshot 2025-02-16 100944.png
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
added current signal length......

still need price change since current signal......h

//-----

MQL5:
     if(NewBar() || weekend)
     { 
 
 
    for(int r = 0; r < 4; r++)                        // string sym[4]          = {"MYMH25", "MESH25", "MNQH25", "M2KH25"};       
      {
 
       Display(sym[r],  20, 200+(r*100));             
       ObjectSetText(sym[r], sym[r],10,"Verdana", clrAqua);
 
 
      for(int t = 0; t < 7; t++)                      //   string tfs[14]         = {"1", "5", "15", "30", "60", "240", "1440"};                   
      {
       color  clr    = clrYellow;
       string symbol = sym[r]+tfs[t];
 
       Display(tfs[t],  200+(t*300), 100);             
       ObjectSetText(tfs[t], tfs[t],10,"Verdana", clrAqua);
 
 
       if(GlobalVariableGet(symbol) ==  10) {clr = clrLime;}
       if(GlobalVariableGet(symbol) == -10) {clr = clrViolet;}
 
       Display(symbol,  200+(t*300), 200+(r*100));     
 
       ObjectSetText(symbol, "ÛÛÛÛ",10,"Terminal", clr);
 
 
 
       Display(symbol+"count",  300+(t*300), 200+(r*100));       
 
       ObjectSetText(symbol+"count", IntegerToString(GlobalVariableGet(symbol+"count")),10,"Verdana", clr);
 
      }
      }
 
   }

//-----
Screenshot 2025-02-16 205841.png
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
psar[1], psar[2] and 20 sma........h
//------


MQL5:
//------ alerts v count.mq5  sets global variables
 
 
           if(ma20s[1] > ma20s[2])  {GlobalVariableSet(_Symbol+tfs[j]+"ma", 10);}  else  {GlobalVariableSet(_Symbol+tfs[j]+"ma", -10);}             
 
 
 
           if(iHigh(_Symbol,tf[j],0) > psars[0])
           {         
           psarclr[j]     = clrBlue;  GlobalVariableSet(_Symbol+tfs[j]+"p1",10);                       
           }
           else
           {         
           psarclr[j]     = clrRed;  GlobalVariableSet(_Symbol+tfs[j]+"p1",-10);                             
           }
 
           if(iHigh(_Symbol,tf[j],1) > psars[1])
           {         
           psarclr2[j]    = clrBlue;  GlobalVariableSet(_Symbol+tfs[j]+"p2",10);                             
           }
           else
           {         
           psarclr2[j]    = clrRed;  GlobalVariableSet(_Symbol+tfs[j]+"p2",-10);                             
           }

//-----


MQL5:
       //if(sym[r]+tfs[t]"p1")
 
       color clrs1 = clrYellow;   //----- set clrRed default
       color clrs2 = clrYellow;   //----- set clrRed default
       color clrs3 = clrYellow;   //----- set clrRed default
 
       if(GlobalVariableGet(symbol+"p1") ==  10)  {clrs1 = clrLime;} else {clrs1 = clrRed;}   //--- reduce else
 
       Display(symbol+"p1",  300+(t*300), 200+(r*100));       
       ObjectSetText(symbol+"p1", "Û",10,"Terminal", clrs1);
 
 
 
       if(GlobalVariableGet(symbol+"p2") ==  10)  {clrs2 = clrLime;} else {clrs2 = clrRed;}   //--- reduce else
 
       Display(symbol+"p2",  330+(t*300), 200+(r*100));       
       ObjectSetText(symbol+"p2", "Û",10,"Terminal", clrs2);
 
 
 
       if(GlobalVariableGet(symbol+"ma") ==  10)  {clrs3 = clrLime;} else {clrs3 = clrRed;}   //--- reduce else
 
       Display(symbol+"ma",  270+(t*300), 200+(r*100));       
       ObjectSetText(symbol+"ma", "Û",10,"Terminal", clrs3);
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
migrating from mq4 to mq5......

11. Date and Time Functions ......h

//------

MQL5:
     Comment("alerts dashboard.mq5 emailed  "+ hours()+"  "+minutes());  
 
     if(NewBar() || weekend)
     {  
 
//------  hour and minute are variables set in inputs section
 
    if((hours() == hour) && (minutes() > minute))  {Alert("crtitical time check trades");}    //------ verified
 
//------    
 
//------  https://www.mql5.com/en/articles/81
//------  11. Date and Time Functions
 
int hours()
  {
   MqlDateTime tm;
   TimeCurrent(tm);
   return(tm.hour);
  }
 
 
int minutes()
  {
   MqlDateTime tm;
   TimeCurrent(tm);
   return(tm.min);
  }
//------
 
Last edited:

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
trading against the trend or in highly volatile times adds an unnecessary element of risk......h

//------
//------
Screenshot 2025-02-20 074030.png
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
note to me......

1. code a atr triangle projection indicator....... this is something i do manually.....

today is a terrible example because it is working so well.....

first place both horizontal and vertical lines on the days close....... then place rays above and below, about 1% or the daily atr...... extend out 24 hours.....

you will have a chart such as below.....

the idea is the atr is the atr for a reason...... h
//-------

Screenshot 2025-02-26 105505.png
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
example of using symbol last to get the last price...... SYMBOL_LAST Price of the last deal......


color symbol relative to last price above/below day open......

a timeframe input might be useful.....h
//------

MQL5:
    for(int r = 0; r < 9; r++)                        
      {
 
//-----    if(iOpen(_Symbol,PERIOD_D1,0) < SymbolInfoDouble(_Symbol,SYMBOL_LAST))  {GlobalVariableSet(_Symbol+"last", 10);}   else {GlobalVariableSet(_Symbol+"last", -10);}
 
 
       color lastclr = clrRed;
       if(GlobalVariableGet(sym[r]+"last") ==  10) {lastclr = clrLime;}
 
       Display(sym[r],  20, 200+(r*100));            
       ObjectSetText(sym[r], sym[r],10,"Verdana", lastclr);

//-----

Screenshot 2025-02-28 115247.png
 
Last edited:

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
the only thing more confusing than a dashboard with a hundred objects is a expert advisor with a hundred inputs..... at least to me......

as in the prior post chart , explanations can be written out....... there might be times where the room to do so does not exist......

OBJPROP_TOOLTIP lets us see the explanation when the the mouse curser is placed over the object...... perfect cure for a bad memory.....

my memory has limits...... h
//-------

MQL5:
       if(GlobalVariableGet(symbol) ==  10) {clr = clrLime;}
       if(GlobalVariableGet(symbol) == -10) {clr = clrRed;}
 
       Display(symbol,  200+(t*300), 200+(r*100));                   
       ObjectSetText(symbol, "ÛÛÛ",10,"Terminal", clr);
       ObjectSetString(0, symbol, OBJPROP_TOOLTIP, "if((almas[1] > almas[2]) && (hmas[1] > hmas[2]) && (coppocks[1] > coppocks[2]))");
//-----
 
       if(GlobalVariableGet(symbol+"50ma") ==   10)  {clrs50 = clrLime;}
       if(GlobalVariableGet(symbol+"50ma") ==  -10)  {clrs50 = clrRed;}   
 
       Display(symbol+"50ma",  270+(t*300), 200+(r*100));       
       ObjectSetText(symbol+"50ma", "Û",10,"Terminal", clrs50);
       ObjectSetString(0, symbol+"50ma", OBJPROP_TOOLTIP, "if(ma50s[1] > ma50s[2])");       
//-----
 
       if(GlobalVariableGet(symbol+"ma") ==   10)  {clrs3 = clrLime;}
       if(GlobalVariableGet(symbol+"ma") ==  -10)  {clrs3 = clrRed;}   
 
       Display(symbol+"ma",  290+(t*300), 200+(r*100));       
       ObjectSetText(symbol+"ma", "Û",10,"Terminal", clrs3);
       ObjectSetString(0, symbol+"ma", OBJPROP_TOOLTIP, "if(ma20s[1] > ma20s[2])");
//-----       
 
       if(GlobalVariableGet(symbol+"ahm") ==   10)  {clrs4 = clrLime;}
       if(GlobalVariableGet(symbol+"ahm") ==  -10)  {clrs4 = clrRed;}   
 
       Display(symbol+"ahm",  310+(t*300), 200+(r*100));       
       ObjectSetText(symbol+"ahm", "Û",10,"Terminal", clrs4);
       ObjectSetString(0, symbol+"ahm", OBJPROP_TOOLTIP, "if((almas[0] > ma20s[0]) && (hmas[0] > ma20s[0]))");       
//-----


//-----

Screenshot 2025-03-05 071658.png
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
a simple method for bulk mtf indicators bar by bar in the same window still escapes me..... mind burning methods do exist......

sometimes i really do miss mq4.....
//-----

my first somewhat unstable shot at it.....

top down order.....

15 minute coppock, hma, alma.....

5 minute coppock, hma, alma......

1 minute coppock, hma, alma, stochastic, ao.....
//------

need to vastly reduce the code and add a few more indicators to the mix.....

logic is easy to see...... hard part is waiting.....h
//----

Screenshot 2025-03-10 032027.png
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
this will be an issue for admittedly very few people.......

objprop_tooltip does not appear to work on undocked charts when the chart is moved to another monitor........... or at least i have not found a way to have it work.....

so if you have a multi screen setup and use/require tool tips, they will work best on which ever screen the actual platform itself resides......

by that i mean, on a computer with 3 extra monitors, if the metatrader platform itself is on screen 4, tooltips will work properly on screen 4...... whether the chart is docked or not....... but if you move the undocked chart to screen 3, the tooltips do not appear to work......

if you move the undocked charts to the computers main screen, the tooltips will work but will be incredibly small and out of place......

if the metatrader platform itself is on computers main screen, tooltips will work their whether the chart is docked or not...... however, like before, if you move the undocked chart to any other screen, the tooltips will not work......

you can of course have 4 identical platforms running, one on each monitor, which is somewhat of a workaround......

a workaround with a cost......h

//------

MQL5:
       ObjectSetString(0, symbol+"50ma", OBJPROP_TOOLTIP, "if(ma50s[1] > ma50s[2])");    
//-----
 
       if(GlobalVariableGet(symbol+"ma") ==   10)  {clrs3 = clrLime;}
       if(GlobalVariableGet(symbol+"ma") ==  -10)  {clrs3 = clrRed;}
 
       Display(symbol+"ma",  290+(t*300), 200+(r*100));    
       ObjectSetText(symbol+"ma", "Û",10,"Terminal", clrs3);
       ObjectSetString(0, symbol+"ma", OBJPROP_TOOLTIP, "if(ma20s[1] > ma20s[2])");
//-----
 
  • ℹ️
Reactions: Enivid

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
cant get array copy to work with volumes.... gives goofy numbers.....

code below works......

increasing volume can not be used to verify momentum or trend......

useful in other ideas......h

//------

MQL5:
            if(iVolume(_Symbol,tf[j],0) >  iVolume(_Symbol,tf[j],1))  {GlobalVariableSet(_Symbol+tfs[j]+"volume",  10); } // can't get arraycopy to work..... this does.....
 
            if(iVolume(_Symbol,tf[j],0) <  iVolume(_Symbol,tf[j],1))  {GlobalVariableSet(_Symbol+tfs[j]+"volume", -10); }

//------

Screenshot 2025-03-27 115411.png
 

Enivid

Administrator
Staff member
Nov 30, 2008
19,495
1,596
144
Odesa
www.earnforex.com
cant get array copy to work with volumes.... gives goofy numbers.....

code below works......

increasing volume can not be used to verify momentum or trend......

useful in other ideas......h

//------

MQL5:
            if(iVolume(_Symbol,tf[j],0) >  iVolume(_Symbol,tf[j],1))  {GlobalVariableSet(_Symbol+tfs[j]+"volume",  10); } // can't get arraycopy to work..... this does.....
 
            if(iVolume(_Symbol,tf[j],0) <  iVolume(_Symbol,tf[j],1))  {GlobalVariableSet(_Symbol+tfs[j]+"volume", -10); }

//------

View attachment 31853
Are you trying it with CopyRealVolume() or CopyTickVolume()?
 

hayseed

Master Trader
Jul 27, 2010
1,220
287
149
usa
hey enivid..... thanks for the reply......

saw both those functions but tried neither.....

was trying the same arraycopy method which has worked without fail before....

the basic code is very simple, we both could write every line of it in our heads..... until volume for me.....

the only difference i can see is ivolume requires a shift where the others do not.....

the indicator sets all the global values for it's symbol and 7 common timeframes......

the dashboard indicator then cycles thru all the global values and displays them....

i will read up on the functions you mentioned.......

my goal is to see the coppock indicator and all others, in a single at a glance screen.....h

//------- using iVolume(_Symbol,tf[j],0) > iVolume(_Symbol,tf[j],1) works

MQL5:
//-------  individual []  arrays declared above
 
 
 for(int i = 0; i < 7; i++)    // 7 timeframes
      {
 
      alma[i]     = iCustom(_Symbol,tf[i],"alma");
      coppock[i]  = iCustom(_Symbol,tf[i],"Coppock");
      hma[i]      = iCustom(_Symbol,tf[i],"hma",20,2.0);
      //schaff[i]   = iCustom(_Symbol,tf[i],"schaff");
      psar[i]     = iSAR(_Symbol,tf[i],0.01,0.2);
      ma10[i]     = iMA(_Symbol,tf[i],10,0,MODE_SMA,PRICE_CLOSE);
      ma20[i]     = iMA(_Symbol,tf[i],20,0,MODE_SMA,PRICE_CLOSE);
      ma50[i]     = iMA(_Symbol,tf[i],50,0,MODE_SMA,PRICE_CLOSE);
      stoch[i]    = iStochastic(_Symbol,tf[i], 10, 3, 6, MODE_SMA, STO_CLOSECLOSE);
      atr[i]      = iATR(_Symbol,tf[i],20);
      ao[i]       = iAO(_Symbol,tf[i]);
      tema[i]     = iTEMA(_Symbol,tf[i],20,0,PRICE_CLOSE);
      dema[i]     = iDEMA(_Symbol,tf[i],20,0,PRICE_CLOSE);
      vol[i]      = iRealVolume(_Symbol,tf[i],0);              // insists on a shift where others do not have tried several versions
      bars        = iBars(_Symbol,tf[i]);
 
      }
 
 
    for(int j = 0; j < 7; j++)  // 7 timeframes
      {
 
        double vols[];
 
        ArraySetAsSeries(vols,true);
 
        CopyBuffer(vol[j],0,0,4,vols);
 
 
        double almas[];
 
        ArraySetAsSeries(almas,true);
 
        CopyBuffer(alma[j],0,0,20,almas);
 
 
        double coppocks[];
 
        ArraySetAsSeries(coppocks,true);
 
        CopyBuffer(coppock[j],0,0,20,coppocks);
 
//----------        repetitive array copy
 
//-----------  global variables set in this manner
 
            if(coppocks[1] > coppocks[2])  { GlobalVariableSet(_Symbol+tfs[j]+"coppock", 10); }  
 
            if(coppocks[1] < coppocks[2])  { GlobalVariableSet(_Symbol+tfs[j]+"coppock",-10); }
 
            if(coppocks[1] > 0)            { GlobalVariableSet(_Symbol+tfs[j]+"coppock0", 10); }  
 
            if(coppocks[1] < 0)            { GlobalVariableSet(_Symbol+tfs[j]+"coppock0",-10); }
 
 
            GlobalVariableSet(_Symbol+tfs[j]+"ahm", 0);
 
            if((hmas[0] > almas[0]) && (almas[0] > ma10s[0]) && (ma10s[0] > ma20s[0]))  {GlobalVariableSet(_Symbol+tfs[j]+"ahm", 10); }
 
            if((hmas[0] < almas[0]) && (almas[0] < ma10s[0]) && (ma10s[0] < ma20s[0]))  {GlobalVariableSet(_Symbol+tfs[j]+"ahm",-10); }
 
 
            //if( !((almas[1] > almas[2]) && (hmas[1] > hmas[2]) && (coppocks[1] > coppocks[2])) && !((almas[1] < almas[2]) && (hmas[1] < hmas[2]) && (coppocks[1] < coppocks[2])))   {clr[j] = clrYellow;  GlobalVariableSet(_Symbol+tfs[j],0);}
 
 
            if(aos[0] >  aos[1])  {GlobalVariableSet(_Symbol+tfs[j]+"ao",  10); }
 
            if(aos[0] <= aos[1])  {GlobalVariableSet(_Symbol+tfs[j]+"ao", -10); }
 
 
            if(temas[0] >  temas[1])  {GlobalVariableSet(_Symbol+tfs[j]+"tema",  10); }
 
            if(temas[0] <= temas[1])  {GlobalVariableSet(_Symbol+tfs[j]+"tema", -10); }
 
 
            if(demas[0] >  demas[1])  {GlobalVariableSet(_Symbol+tfs[j]+"dema",  10); }
 
            if(demas[0] <= demas[1])  {GlobalVariableSet(_Symbol+tfs[j]+"dema", -10); }
 
            //
            if(iVolume(_Symbol,tf[j],0) >  iVolume(_Symbol,tf[j],1))  {GlobalVariableSet(_Symbol+tfs[j]+"volume",  10); } // can't get arraycopy to work..... this does.....
 
            if(iVolume(_Symbol,tf[j],0) <  iVolume(_Symbol,tf[j],1))  {GlobalVariableSet(_Symbol+tfs[j]+"volume", -10); }
 
//------

//------

Screenshot 2025-03-27 124633.png