learning mql5

the 1962 coppock curve used a wma...... it's a rate of change type deal......

the mq5 version has a periods input...... InpPeriod = 10; // Period
that input seems to have to do with bars/rate limit and not periods as we normally think...... however, we can still use it in the traditional way......

iMA(NULL,PERIOD_CURRENT,1,0,MODE_SMA,InpAppliedPrice); where 1 is hard coded periods..... 1 might be the equivalent of no lag......

lot of water has gone under the bridge since then...... wonder if there is something better today......

what if we substitute something else for a sma(1) ......

what if we make it a single indicator with multiple choice......

at first glance, rsi version seems promising......

admittedly, first glances can be deceiving......h

//------
MQL5:
   handle_mar=  iRSI(NULL,PERIOD_CURRENT,InpPeriod,InpAppliedPrice);  //       iMA(NULL,PERIOD_CURRENT,1,0,MODE_SMA,InpAppliedPrice);
 
//  we can use  InpPeriod even though  it's true purpose is in setting  period_ind
//  period_ind=int(InpPeriod<2 ? 2 : InpPeriod); 
// we are just piggy backing  InpPeriod to suit or purpose

//------ rsi version in magenta ..... standard version in yellow

Screenshot 2025-09-04 133350.png
 
mq5 versions by mqlsoft versions of john ehlers 2 and 3 pole butterworth filters.....

amazon has ehlers book, Cybernetic Analysis for Stocks and Futures, over 50% off right now..... 57$...... considering that is barely over the price of a single point on a es_u future, seems like free......

pdf below.....
//-------

method of comparison between butterworth and super smoother on 7 timeframes............

simple concept should be obvious......h

//-------

MQL5:
      threepbw[j] = iCustom(symbol,tf[j],"3pbw");        //--   https://www.mql5.com/en/code/584
      threepss[j] = iCustom(symbol,tf[j],"3pss");        //--   https://www.mql5.com/en/code/589
 
 
//-----
 
        double threepbws[];
 
        ArraySetAsSeries(threepbws,true); 
 
        CopyBuffer(threepbw[k],0,0,20,threepbws);
//-----
        double threepsss[];
 
        ArraySetAsSeries(threepsss,true); 
 
        CopyBuffer(threepss[k],0,0,20,threepsss);
//----     
 
 
 
//------
            color clr = clrYellow;
 
 
            if((threepsss[0] > threepbws[1]))  { clr = clrAqua;   }
 
            if((threepsss[0] < threepbws[1]))  { clr = clrMagenta;}
//-----         
 
               Display(symbol+tfs[k]+"3pbw",  3300+(k*50), 100+(i*50));                         
               ObjectSetText(symbol+tfs[k]+"3pbw", "ÛÛ",10,"Terminal", clr);
               ObjectSetString(0, symbol+tfs[k]+"3pbw", OBJPROP_TOOLTIP, symbol+"  "+IntegerToString(tfs[k])+"3pss >< 3pbw");                             
 
 
 
        }  //-----  for(int k = 0; k < 7; k++)
//----
 
       }   //-----      for(int i = 0; i < total; i++)
 
               Display("3pbw",  3300, 1600);                     
               ObjectSetText("3pbw", "3pss >< 3pbw",10,"Verdana", clrAqua);
 
       }  //------        if(NewBar() || weekend)



//-------

Screenshot 2025-09-05 215558.png
 

Attachments

  • 👍
Reactions: Enivid
comparing ehlers instantaneous trend line to its trigger..... 7 timeframes..... aqua if trigger above trendline..... magenta if below.....

here because 2 buffers are being used we must copy both...... 0 and 1..... copybuffer......

this might be the only indicator i can think of where the main signal takes a back seat to the trigger...... as a rule the trigger line is always slowest...... not so here...... that must be taken into consideration on the > or < comparison.....

the book says there is no lag..... seems odd..... surely there must be some sort of lag......

maybe my definition of lag is incorrect......h

//------

MQL5:
//----       
 
        double itls[];   
 
        ArraySetAsSeries(itls,true);   
 
        CopyBuffer(itl[k],0,0,4,itls); //trend line buffer 0   https://www.mql5.com/en/docs/series/copybuffer  Instantaneous Trendline.mq5
 
 
        double itlts[];
 
        ArraySetAsSeries(itlts,true);   
 
        CopyBuffer(itl[k],1,0,4,itlts); // trigger line buffer 1   https://www.mql5.com/en/docs/series/copybuffer  Instantaneous Trendline.mq5
 
 
//------
            color clr = clrYellow;
 
 
            if((itlts[0] > itls[0]))  { clr = clrAqua;   }    // trigger buffer leads
 
            if((itlts[0] < itls[0]))  { clr = clrMagenta;} 
//-----           
 
               Display(symbol+tfs[k]+"itlt",  3900+(k*50), 100+(i*50));                           
               ObjectSetText(symbol+tfs[k]+"itlt", "ÛÛ",10,"Terminal", clr);
               ObjectSetString(0, symbol+tfs[k]+"itlt", OBJPROP_TOOLTIP, symbol+"  "+IntegerToString(tfs[k])+" trend line >< trigger");                               
 
 
 
        }  //-----  for(int k = 0; k < 7; k++)
//----
 
       }   //-----      for(int i = 0; i < total; i++)
 
               Display("itlt",  3900, 1600);                       
               ObjectSetText("itlt", "trend line >< trigger",10,"Verdana", clrAqua);
 
       }  //------        if(NewBar() || weekend)

//-----

Screenshot 2025-09-05 233456.png


//-------

Screenshot 2025-09-05 233619.png

//------
 

Attachments

  • 👍
Reactions: Enivid
separate windows for displaying alma, hma, ehlers two and three pole butterworths and instantaneous tend line...... and others.......up aqua.... down magenta.....

primary goal is to visualize entrys and exits..... along with minor goals..... such as leaders/laggers in response..... estimation in upcoming signals as in minutes, hours, days or weeks from now.......

all in a single window is next on the to do list......h
//-------

Screenshot 2025-09-06 120059.png
 
all in a single window is next on the to do list......h


.....h
//-----

MQL5:
   if(alma)      { handlealma =  iCustom(NULL,PERIOD_CURRENT,"alma");          position = 0.80;}
   if(hma)       { handlealma =  iCustom(NULL,PERIOD_CURRENT,"hma",10,2.0);    position = 0.70;}
   if(jma)       { handlealma =  iCustom(NULL,PERIOD_CURRENT,"jma");           position = 0.60;}
   if(twopbw)    { handlealma =  iCustom(NULL,PERIOD_CURRENT,"2pbw");          position = 0.50;}
   if(threepbw)  { handlealma =  iCustom(NULL,PERIOD_CURRENT,"3pbw");          position = 0.40;}
   if(itl)       { handlealma =  iCustom(NULL,PERIOD_CURRENT,"itl");           position = 0.30;}
   if(satl)      { handlealma =  iCustom(NULL,PERIOD_CURRENT,"satl");          position = 0.20;}
   if(hma89)     { handlealma =  iCustom(NULL,PERIOD_CURRENT,"hma",89,2.0);    position = 0.10;}
//-----
 
  {
//---
 
   if(Bars(_Symbol,_Period)<rates_total) return(prev_calculated);
   double almas[];
 
   CopyBuffer(handlealma,0,0,rates_total,almas);
 
   for(int i=rates_total-1; i>0;i--)
     {
        up[i]=dn[i]=EMPTY_VALUE;
 
       if(almas[i] > almas[i-1])  up[i] = position;
 
       if(almas[i] < almas[i-1])  dn[i] = position;
 
 
 
 
     }


Screenshot 2025-09-07 080818.png
Screenshot 2025-09-07 080804.png
//---

Screenshot 2025-09-07 080629.png
 

Attachments

  • Screenshot 2025-09-07 080818.png
    Screenshot 2025-09-07 080818.png
    113.6 KB · Views: 0
it would seem best to arrange them in a fastest to slowest manner..... but whats what.......

placing the selections above the indicator mapping section, allows use to adjust the plotindexsetstring to match the selection chosen.....

this way, hovering the mouse over the dots will tell which indicator selected...... just in case we forget whats what.......

memory not included......h
//-----

MQL5:
int OnInit()
  {
   string indicator = "";            //  https://www.mql5.com/en/docs/constants/indicatorconstants/drawstyles#enum_plot_property_integer
                                     //  https://www.mql5.com/en/docs/customind/plotindexsetstring
 
   if(jjma)      { handlealma =  iCustom(NULL,PERIOD_CURRENT,"jjma");          position = 1.00; indicator = "jjma";}
   if(jfatl)     { handlealma =  iCustom(NULL,PERIOD_CURRENT,"jfatl");         position = 0.90; indicator = "jfatl";}
   if(alma)      { handlealma =  iCustom(NULL,PERIOD_CURRENT,"alma");          position = 0.80; indicator = "alma";}
   if(hma)       { handlealma =  iCustom(NULL,PERIOD_CURRENT,"hma",10,2.0);    position = 0.70; indicator = "hma 10";}
   if(jma)       { handlealma =  iCustom(NULL,PERIOD_CURRENT,"jma");           position = 0.60; indicator = "jma";}
   if(twopbw)    { handlealma =  iCustom(NULL,PERIOD_CURRENT,"2pbw");          position = 0.50; indicator = "2pbw";}
   if(threepbw)  { handlealma =  iCustom(NULL,PERIOD_CURRENT,"3pbw");          position = 0.40; indicator = "3pbw";}
   if(itl)       { handlealma =  iCustom(NULL,PERIOD_CURRENT,"itl");           position = 0.30; indicator = "itl";}
   if(satl)      { handlealma =  iCustom(NULL,PERIOD_CURRENT,"satl");          position = 0.20; indicator = "satl";}
   if(hma89)     { handlealma =  iCustom(NULL,PERIOD_CURRENT,"hma",89,2.0);    position = 0.10; indicator = "hma 89";}
 
 
 
//--- indicator buffers mapping
   SetIndexBuffer(0,up,INDICATOR_DATA);
   SetIndexBuffer(1,dn,INDICATOR_DATA);
//--- setting a code from the Wingdings charset as the property of PLOT_ARROW
   PlotIndexSetInteger(0,PLOT_ARROW,159);
   PlotIndexSetString(0,PLOT_LABEL,indicator);
   PlotIndexSetInteger(1,PLOT_ARROW,159);
   PlotIndexSetString(1,PLOT_LABEL,indicator);

//----

Screenshot 2025-09-07 110219.png
 
lean hogs sounds like a oxymoron......

OBJPROP_TOOLTIP ...... mouseover function......

just to be sure.....h

//---------
MQL5:
    for(int i = 0; i < total; i++)
      { 
 
       string symbol = SymbolName(i,true);     
 
       Display(symbol+"hma50", 4300, 100+(i*50));                 
       ObjectSetText(symbol+"hma50", symbol, 10, "Verdana", clrAqua);
       ObjectSetString(0, symbol+"hma50", OBJPROP_TOOLTIP, SymbolInfoString(symbol, SYMBOL_DESCRIPTION));                               
       //--  mouse over symbol to display descrition
 
 
//----

//----

mouseover.png
 
added margin initial and tick value......

my preference is point value......h
//------

MQL5:
    for(int i = 0; i < total; i++)
      { 
 
       string symbol = SymbolName(i,true);     
 
       double pointvalue = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE)* (1/SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE));
 
       Display(symbol+"hma", 400, 100+(i*50));                 
       ObjectSetText(symbol+"hma", symbol, 10, "Verdana", clrAqua);                       
       ObjectSetString(0, symbol+"hma", OBJPROP_TOOLTIP, SymbolInfoString(symbol, SYMBOL_DESCRIPTION)+"  margin required "+SymbolInfoDouble(symbol, SYMBOL_MARGIN_INITIAL)+"  tick value "+SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE));   
 
       //--  mouse over symbol to display descrition
       //--  https://www.mql5.com/en/docs/marketinformation/symbolinfodouble       //         
       //--  https://www.mql5.com/en/docs/marketinformation/symbolinfostring       
       //--  https://www.mql5.com/en/docs/marketinformation/symbolinfointeger       
       //--       
 
 
 
//----

mouseover 2.png
 
......h

//------

MQL5:
//+------------------------------------------------------------------+
//|                                      darwin performance fees.mq5 |
//|                                                           .....h |
//|                                                    hayseedfx.com |
//+------------------------------------------------------------------+
#property copyright ".....h"
#property link      "hayseedfx.com"
#property version   "1.00"
 
#property script_show_inputs
 
input double assets  = 200000.0;     // your assets under management
input double balance = 1000000.0;    // your metatrader begining account balance
input double risk    = 1;            // your darwin risk factor
input double profit  = 2000.0;       // your profit made
 
 
 
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---  (100,000/1,000,000)*(200,000)*(0.15*risk) == 3000....
 
 double fees = ((profit/balance)*assets)*(risk*0.15);
 
 
  Alert(DoubleToString(fees,0)+" paid on  "+ IntegerToString(profit)+" profit made");
  }
//+------------------------------------------------------------------+
 
varying size of square or wingding to denote extreme value or some such item of interest......

stochastic for example.....h
//-----

MQL5:
            color clr  = clrYellow;
 
            int   size = 10;
 
 
            if((stochs[0] < 90.0) && (stochs[0] > 10.0) && (stochs[0] > stochs[1]))  { clr = clrAqua;   }  //   
 
            if((stochs[0] > 10.0) && (stochs[0] < 90.0) && (stochs[0] < stochs[1]))  { clr = clrMagenta;}  //   
 
            if((stochs[0] < 10.0))  { clr = clrRed; } 
 
            if((stochs[0] > 90.0))  { clr = clrBlue;} 
 
            double stv = stochs[0];
 
            if((stv >= 98) || (stv <= 2)) {size = 12;}  // visual increasing size to place emphasis extreme values
 
 
               Display(symbol+tfs[k]+"stoch",  910+(k*50), 100+(i*50));                     
               ObjectSetText(symbol+tfs[k]+"stoch", "ÛÛ",size,"Terminal", clr);
               ObjectSetString(0, symbol+tfs[k]+"stoch", OBJPROP_TOOLTIP, symbol+" stoch "+IntegerToString(tfs[k])+" "+DoubleToString(stv,2));                               
 
 
             if(alerts)
             {
             if(stv >= 99.50) {Alert(symbol +" "+ tfs[k]+" stoch >= 99.50");}
 
             if(stv <=  0.50) {Alert(symbol +" "+ tfs[k]+" stoch <= 0.5");}
             }
 
        }  //-----  for(int k = 0; k < 7; k++)
//----

//-------

Screenshot 2025-09-18 045733.png
 
kositsin's mq5 laguerre indicator.....

edited line 48 to increase digits + 2 for greater accuracy ym.........

it's a rounding issue......h
//-------

MQL5:
//------
            color clr = clrYellow;
 
            int   size = 10;
 
 
            if(laguerres[0] > 0.50)                                     { clr = clrBlue;   }  
 
            if(laguerres[0] < 0.50)                                     { clr = clrRed;    }
 
//                                          == 50.0                                    { clr = clrYellow;   } 
 
            if((laguerres[0] > laguerres[1]) && (laguerres[0] < 0.50))  { clr = clrAqua;   }  
 
            if((laguerres[0] < laguerres[1]) && (laguerres[0] > 0.50))  { clr = clrMagenta;}
 
 
            double lagv = laguerres[0];
 
            if((lagv == 1.0) || (lagv == 0.0)) {size = 12;}  // visual aid
 
 
 
//-----          
 
               Display(symbol+tfs[k]+"laguerre",  3270+(k*50), 1000+(i*50));                          
               ObjectSetText(symbol+tfs[k]+"laguerre", "ÛÛ",size,"Terminal", clr);
               ObjectSetString(0, symbol+tfs[k]+"laguerre", OBJPROP_TOOLTIP, symbol+"  "+IntegerToString(tfs[k])+" laguerre >< laguerre");

//----- larger block size denotes value pegged at 0.00 or 1.00.....

Screenshot 2025-09-21 132254.png
 
account_name .... account information.....

account_login...... account number.....

as example...... if multiple accounts are running the same ea and push notifications are being sent to your phone......

sending the account number and account name will let you know who did what......

or who did not.....h

//-------

//-------- code below combines the profit of each symbol..... if total combined is greater than a preset amount, trades will be closed .......

MQL5:
 int total=SymbolsTotal(true);
 
     if(NewBar())     //---- new bar such as check once per minute
     { 
 
 
    for(int i = 0; i < total; i++)
      { 
 
       string symbol = SymbolName(i,true);   
 
       if(symbolprofit(symbol) > symboltarget)                                                       // line 16.....   input double symboltarget        = 5000;                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
       {
        Alert("symbol target hit closing all  " +symbol+ "  "+DoubleToString(symbolprofit(symbol),0)+"  "+ AccountInfoInteger(ACCOUNT_LOGIN)+ "  " +AccountInfoString(ACCOUNT_NAME));
        SendNotification("symbol target hit closing all  " +symbol+ "  "+DoubleToString(symbolprofit(symbol),0)+"  "+ AccountInfoInteger(ACCOUNT_LOGIN)+ "  " +AccountInfoString(ACCOUNT_NAME));
 
        closeallsymbol(symbol);                                                                     //   closeallsymbol(string symbol)
        closeallsymbol(symbol);
        closeallsymbol(symbol);
 
        Alert("symbol target hit closing all  " +symbol+ "  "+DoubleToString(symbolprofit(symbol),0)+"  "+ AccountInfoInteger(ACCOUNT_LOGIN)+ "  " +AccountInfoString(ACCOUNT_NAME));
        SendNotification("symbol target hit closing all  " +symbol+ "  "+DoubleToString(symbolprofit(symbol),0)+"  "+ AccountInfoInteger(ACCOUNT_LOGIN)+ "  " +AccountInfoString(ACCOUNT_NAME));
     }
     }
     }  //  if(NewBar())
 
  }
//+------------------------------------------------------------------+
 
 
//------   if(symbolprofit(symbol) > symboltarget) 
 
 
double symbolprofit(string symbol)                                               
      {
       double profit = 0.0;                                 
 
       for(int i=PositionsTotal()-1; i>=0; i--)                             //----- https://www.mql5.com/en/docs/trading/positionstotal
       {
 
       if(PositionGetSymbol(i) !=symbol) continue;                        //----- https://www.mql5.com/en/docs/trading/positiongetsymbol
 
       profit += PositionGetDouble(POSITION_PROFIT);                  //---- https://www.mql5.com/en/docs/trading/positiongetdouble
       }
 
       return(profit);
 
      }
 
 
//-----
 
void closeallsymbol(string symbol)                                          //----- closes  string symbol only
   {
    for(int i=PositionsTotal()-1; i>=0; i--)                                //----- https://www.mql5.com/en/docs/trading/positionstotal
       {
       ulong ticket = PositionGetTicket(i);                                 //----- https://www.mql5.com/en/docs/trading/positiongetticket
 
       if(PositionGetSymbol(i) != symbol)         continue;                 //----- https://www.mql5.com/en/docs/trading/positiongetsymbol
 
       if(PositionGetSymbol(i) == symbol)
       {
       trade.PositionClose(ticket);
       }
       }                                                                    //----- differences betweeen poistions, orders and deals....  https://www.mql5.com/en/articles/211
//----
 
    for(int i=OrdersTotal()-1; i>=0; i--)                                   //----- https://www.mql5.com/en/docs/trading/orderstotal
       {
       ulong tickets = OrderGetTicket(i);                                   //----- https://www.mql5.com/en/docs/trading/ordergetticket
 
       if(OrderGetString(ORDER_SYMBOL) != symbol) continue;                 //----- https://www.mql5.com/en/docs/trading/ordergetstring
 
       if(OrderGetString(ORDER_SYMBOL) == symbol)                           //----- https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties
       {       
       trade.OrderDelete(tickets);
       }         
       }
 
   }
 
 
 
 
 
 
 
//------
 
The first letter u in the name of the uchar type is the abbreviation for unsigned......

same for types like, ulong, ushort, , , ,,,,,,.... the use of " u " simply means its a positive value only......

unclear of a true need.....h

//------

types /integer ......

integer/types.......

//-----

MQL5:
void OnStart()
  {
//---
 
 
ENUM_TIMEFRAMES tf[]   = {PERIOD_M1, PERIOD_M5, PERIOD_M15, PERIOD_M30, PERIOD_H1, PERIOD_H4, PERIOD_D1};  //PERIOD_M1, PERIOD_M2, PERIOD_M3, PERIOD_M4,
 
string tfs[14]         = {"1", "5", "15", "30", "60", "240", "1440"};   //"1","2","3","4",
 
 
 
 
    int alma[14];
 
 
    for(int j = 0; j < 7; j++)
      { 
 
      alma[j]      = iCustom(_Symbol,tf[j],"alma");    
 
      }  //-----    for(int j = 0; j < 7; j++)
 
 
 
    for(int k = 0; k < 7; k++)
      { 
        int    up       = 0;
        int    dn       = 0;
 
        double almas[];
 
        ArraySetAsSeries(almas,true);   
 
        CopyBuffer(alma[k],0,0,50,almas);
 
 
 
        if(almas[0] > almas[1])
        {       
        for(int i=0;i<20;i++)
        {
        if(almas[i] > almas[i+1])  up++;
 
        if(almas[i] < almas[i+1])  break;
        }
        }
 
        if(almas[0] < almas[1])
        {       
        for(int i=0;i<20;i++)
        {
        if(almas[i] < almas[i+1])  dn++;
 
        if(almas[i] > almas[i+1])  break;
        }
        }
 
 
 
        Print(tfs[k]+"   up =  "+ IntegerToString(up)+"   dn =  "+ IntegerToString(dn));
 
 
        }  //-----  for(int k = 0; k < 7; k++)
//----
 
 
 
 
 
  }
//+------------------------------------------------------------------+
 
......h

//----

MQL5:
    int    selected[14];
 
    string select = "";
 
    for(int j = 0; j < 7; j++)
      { 
       if(jjma)      { selected[j] =  iCustom(_Symbol,tf[j],"jjma");        select = "jjma";}
       if(jfatl)     { selected[j] =  iCustom(_Symbol,tf[j],"jfatl");       select = "jfatl";}
       if(alma)      { selected[j] =  iCustom(_Symbol,tf[j],"alma");        select = "alma";}
       if(hma)       { selected[j] =  iCustom(_Symbol,tf[j],"hma",10,2.0);  select = "hma";}
       if(jma)       { selected[j] =  iCustom(_Symbol,tf[j],"jma");         select = "jma";}
       if(twopbw)    { selected[j] =  iCustom(_Symbol,tf[j],"2pbw");        select = "2pbw";}
       if(threepbw)  { selected[j] =  iCustom(_Symbol,tf[j],"3pbw");        select = "3pbw";}
       if(itl)       { selected[j] =  iCustom(_Symbol,tf[j],"itl");         select = "itl";}
       if(satl)      { selected[j] =  iCustom(_Symbol,tf[j],"satl");        select = "satl";}
       if(hma89)     { selected[j] =  iCustom(_Symbol,tf[j],"hma",89,2.0);  select = "hma";}
 
 
 
      }  //-----    for(int j = 0; j < 7; j++)
 
 
 
    for(int k = 0; k < 7; k++)
      { 
        int    up       = 0;
        int    dn       = 0;
 
        double selecteds[];
 
        ArraySetAsSeries(selecteds,true);   
 
        CopyBuffer(selected[k],0,0,50,selecteds);
 
 
 
        if(selecteds[0] > selecteds[1])
        {       
        for(int i=0;i<20;i++)
        {
        if(selecteds[i] > selecteds[i+1])  up++;
 
        if(selecteds[i] < selecteds[i+1])  break;
        }
        }
 
        if(selecteds[0] < selecteds[1])
        {       
        for(int i=0;i<20;i++)
        {
        if(selecteds[i] < selecteds[i+1])  dn++;
 
        if(selecteds[i] > selecteds[i+1])  break;
        }
        }
 
 
 
        Print(tfs[k]+"  "+select+"   up =  "+ IntegerToString(up)+"   dn =  "+ IntegerToString(dn));
 
 
        }  //-----  for(int k = 0; k < 7; k++)
//----
 
 
 
 
 
  }
//+----
 
mathabs.....

symbols color relative to daily price change.....

mouse over symbol activates tooltip for % change........h

//--------

Screenshot 2025-09-25 094736.png
//---------

MQL5:
  double change(string symbol)
          {
            double value = (iClose(symbol,PERIOD_D1,0)-iClose(symbol,PERIOD_D1,1))/iClose(symbol,PERIOD_D1,1);
 
           return(value*100);                            
          }
 
 
 
 
    for(int i = 0; i < total; i++)
      {
 
       string symbol = SymbolName(i,true);   
 
       color clr   = clrAqua;
 
       double chg = MathAbs(NormalizeDouble(change(symbol),2));   //   https://www.mql5.com/en/docs/math/mathabs
 
       if(chg > 1.0) {clr = clrYellow;}
       if(chg > 2.0) {clr = clrOrange;}
       if(chg > 3.0) {clr = clrRed;}
 
 
       Display(symbol+"spear", 4060, 1000+(i*50));               
       ObjectSetText(symbol+"spear", symbol, 10, "Verdana", clr);
       ObjectSetString(0, symbol+"spear", OBJPROP_TOOLTIP, SymbolInfoString(symbol, SYMBOL_DESCRIPTION)+"  "+DoubleToString(change(symbol),2));                             
       //--  mouse over symbol to display descrition
 
 
//----
 
Last edited:
It is strongly recommended to call the OrderSelect() function before request the order data....... via metaquotes.......

MT5: first select a position via CPositionInfo, directly, or by 'MT4Orders' library (2016)....... via whroeder on mq4/5 forum........
//------

not sure that is entirely true....... order information can be obtained without using the above mentioned suggestions....... however, it's wise to follow the experts......

so i will........h

//---------

selectbyindex.......

orderstotal......

method to remotely disable ea's trading all or in part........ in this case placing a pending order on the 6c_z........

returns true if such order exists........ the ea itself can use that 'true' to carry out actions.......

the simple concept can be expanded greatly.......h
//-----



MQL5:
  if(notradesallowed()) {ExpertRemove();}
 
 
 
 bool notradesallowed()
  {
   int cnt = 0;
 
   for(int i=OrdersTotal()-1; i>=0; i--)          //  https://www.mql5.com/en/docs/trading/orderstotal       
      if(m_order.SelectByIndex(i))                //  https://www.mql5.com/en/docs/standardlibrary/tradeclasses/cpositioninfo/cpositioninfoselectbyindex
        {                     
        if(m_order.Symbol() == "6C_Z") cnt++;
        }
 
        if(cnt > 0) return(true);
                    return(false);
  }
 
method to remotely disable ea's trading all or in part........ in this case placing a pending order on the 6c_z........

returns true if such order exists........ the ea itself can use that 'true' to carry out actions.......

the simple concept can be expanded greatly.......h
//-----
//-----


by that i mean, with just my iphone it's possible to remotely adjust ea settings on computers hundreds of miles away.....

using a laptop, orders can be set with more specific instructions thru order comments...... or just to verify the ea is still running......

the key word is remotely .......

it won't unlatch pet doors.......h

//------

MQL5:
 bool activatetrailingstop()
  {
   int cnt = 0;
 
   for(int i=OrdersTotal()-1; i>=0; i--)          //  https://www.mql5.com/en/docs/trading/orderstotal       
      if(m_order.SelectByIndex(i))                //  https://www.mql5.com/en/docs/standardlibrary/tradeclasses/cpositioninfo/cpositioninfoselectbyindex
        {                     
        if(m_order.Comment() == "activatetrailingstop") cnt++;
        }
 
        if(cnt > 0) return(true);
                    return(false);
  }