Need help! with OnChartEvent comma expected error

 

i compiled it with the aim to show me the spread of the market when i press 'Q' but i get this error " comma expected"

thx,

 

string obj_spread = "Market Spread";  
//+------------------------------------------------------------------+
void OnChartEvent(const int CHARTEVENT_KEYDOWN,         // Event ID
                  const long& Q,   // Parameter of type long event
                  const double& 2, // Parameter of type double event                       // <--------------------------------the error is here
                  const string& NULL  // Parameter of type string events'
  )
  {
        spread = MarketInfo(Symbol(), MODE_SPREAD); 
      s string s = +DoubleToStr(spread, 0)+" pips";
       ObjectCreate(obj_spread, OBJ_LABEL, 0, 0, 0);
       ObjectSet(obj_spread, OBJPROP_CORNER, 0);
       ObjectSet(obj_spread, OBJPROP_YDISTANCE, 16);
       ObjectSet(obj_spread, OBJPROP_XDISTANCE, 190);e
       ObjectSetText(obj_spread, s, 5, "FixedSys", Blue);
    ObjectSetText(obj_spread, s);
    WindowRedraw(); 
  } 
 

Forum on trading, automated trading systems and testing trading strategies


Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.



 
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---
   if(id==CHARTEVENT_KEYDOWN) // CHARTEVENT_KEYDOWN
      if(lparam==71)
        {
         string obj_spread="Market Spread";
         spread=MarketInfo(Symbol(),MODE_SPREAD);
         s string s=+DoubleToStr(spread,0)+" pips";
         ObjectCreate(obj_spread,OBJ_LABEL,0,0,0);
         ObjectSet(obj_spread,OBJPROP_CORNER,0);
         ObjectSet(obj_spread,OBJPROP_YDISTANCE,16);
         ObjectSet(obj_spread,OBJPROP_XDISTANCE,190);e
         ObjectSetText(obj_spread,s,5,"FixedSys",Blue);
         ObjectSetText(obj_spread,s);
         WindowRedraw();
        }
  }
 
barabashkakvn:

Thank u!!

ahh sry i'm new here i didnt know the src button. 

 
how about we answer the question and not argue semantics, we would all like to know how to fix that error. thank you
Reason: