Your input will be appreciated.
kapoo: Am trying to change the signal symbol, I want another symbol instead of arrow.
|
|
whroeder1:
|
Below is what have tried but am still having issue on it.
//+------------------------------------------------------------------+ //| binary.mq4 | //| johness | //| | //+------------------------------------------------------------------+ #property copyright "none" #property link "mmm" #property version "1.00" #property strict #property indicator_chart_window //--- input parameters of the script input string InpNameUP="ArrowUp"; // Sign name UP input string InpNameDOWN="ArrowDown"; // Sign name DOWN input ENUM_ARROW_ANCHOR InpAnchorUP=ANCHOR_TOP; // Anchor type input ENUM_ARROW_ANCHOR InpAnchorDOWN=ANCHOR_BOTTOM; // Anchor type input color InpColorUP=clrGreen; // Sign color UP input color InpColorDOWN=clrRed; // Sign color DOWN input ENUM_LINE_STYLE InpStyle=STYLE_DOT; // Border line style input int InpWidth=5; // Sign size input bool InpBack=false; // Background sign input bool InpSelection=false; // Highlight to move input bool InpHidden=true; // Hidden in the object list input long InpZOrder=0; // Priority for mouse click //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit(void) { return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Indicator | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { static datetime prev; int limit; if(prev_calculated==0) // first calculation or changed history { ObjectsDeleteAll(0,OBJ_ARROW); ChartRedraw(); limit=rates_total-1-4; for(int i=limit;i>=0;i--) { if(time[i]>prev) // new bar { if( close[i+3]>open[i+3] && close[i+2]>open[i+2] && close[i+1]<open[i+2]) { string SELLSIGNAL=InpNameDOWN+"_"+(string)time[i]; ArrowDownCreate(0,SELLSIGNAL,0,time[i+1],high[i+1],InpAnchorDOWN,InpColorDOWN,InpStyle, InpWidth,InpBack,InpSelection,InpHidden); } else if( close[i+3]<open[i+3] && close[i+2]<open[i+2] && close[i+1]>open[i+2]) { string BUYSIGNAL=InpNameUP+"_"+(string)time[i]; ArrowUpCreate(0,BUYSIGNAL,0,time[i+1],low[i+1],InpAnchorUP,InpColorUP,InpStyle, InpWidth,InpBack,InpSelection,InpHidden); } } prev=time[i]; } return(rates_total); } if(time[0]>prev) // new bar { //---- if( close[3]>open[3] && close[2]>open[2] && close[1]<open[2]) { Alert (Symbol()+" M"+Period()+": Sell Alert @ "+DoubleToStr(Bid,Digits)); string SELLSIGNAL=InpNameDOWN+"_"+(string)time[0]; ArrowDownCreate(0,SELLSIGNAL,0,time[1],high[1],InpAnchorDOWN,InpColorDOWN,InpStyle, InpWidth,InpBack,InpSelection,InpHidden); } else if( close[3]<open[3] && close[2]<open[2] && close[1]>open[2]) { Alert (Symbol()+" M"+Period()+": Buy Alert @ "+DoubleToStr(Ask,Digits)); string BUYSIGNAL=InpNameUP+"_"+(string)time[0]; ArrowUpCreate(0,BUYSIGNAL,0,time[1],low[1],InpAnchorUP,InpColorUP,InpStyle, InpWidth,InpBack,InpSelection,InpHidden); } } prev=time[0]; //---- return(rates_total); } //+------------------------------------------------------------------+ //| Create Array Up sign | //+------------------------------------------------------------------+ bool ArrowUpCreate(const long chart_ID=0, // chart's ID const string name="ArrowUp", // sign name const int sub_window=0, // subwindow index datetime time=0, // anchor point time double price=0, // anchor point price //i try to include this , but am still getting error const uchar arrow_code=203, const ENUM_ARROW_ANCHOR anchor=ANCHOR_BOTTOM, // anchor type const color clr=clrRed, // sign color const ENUM_LINE_STYLE style=STYLE_SOLID, // border line style const int width=3, // sign size const bool back=false, // in the background const bool selection=true, // highlight to move const bool hidden=true, // hidden in the object list const long z_order=0) // priority for mouse click { //--- reset the error value ResetLastError(); //--- create the sign if(!ObjectCreate(chart_ID,name,OBJ_ARROW_UP,sub_window,time,price)) { Print(__FUNCTION__, ": failed to create \"Arrow Up\" sign! Error code = ",GetLastError()); return(false); } //with this also ObjectSetInteger(chart_ID,name,OBJPROP_ARROWCODE,arrow_code); //--- set anchor type ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor); //--- set a sign color ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr); //--- set the border line style ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style); //--- set the sign size ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width); //--- display in the foreground (false) or background (true) ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back); //--- enable (true) or disable (false) the mode of moving the sign by mouse //--- when creating a graphical object using ObjectCreate function, the object cannot be //--- highlighted and moved by default. Inside this method, selection parameter //--- is true by default making it possible to highlight and move the object ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection); ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection); //--- hide (true) or display (false) graphical object name in the object list ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden); //--- set the priority for receiving the event of a mouse click in the chart ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order); //--- successful execution return(true); } //+------------------------------------------------------------------+ //| Create Array Down sign | //+------------------------------------------------------------------+ bool ArrowDownCreate(const long chart_ID=0, // chart's ID const string name="ArrowDown", // sign name const int sub_window=0, // subwindow index datetime time=0, // anchor point time double price=0, // anchor point price //i try to include this , but am still getting error const uchar arrow_code=203, const ENUM_ARROW_ANCHOR anchor=ANCHOR_BOTTOM, // anchor type const color clr=clrRed, // sign color const ENUM_LINE_STYLE style=STYLE_SOLID, // border line style const int width=3, // sign size const bool back=false, // in the background const bool selection=true, // highlight to move const bool hidden=true, // hidden in the object list const long z_order=0) // priority for mouse click { //--- reset the error value ResetLastError(); //--- create the sign if(!ObjectCreate(chart_ID,name,OBJ_ARROW_DOWN,sub_window,time,price)) { Print(__FUNCTION__, ": failed to create \"Arrow Down\" sign! Error code = ",GetLastError()); return(false); } //with this also ObjectSetInteger(chart_ID,name,OBJPROP_ARROWCODE,arrow_code); //--- anchor type ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor); //--- set a sign color ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr); //--- set the border line style ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style); //--- set the sign size ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width); //--- display in the foreground (false) or background (true) ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back); //--- enable (true) or disable (false) the mode of moving the sign by mouse //--- when creating a graphical object using ObjectCreate function, the object cannot be //--- highlighted and moved by default. Inside this method, selection parameter //--- is true by default making it possible to highlight and move the object ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection); ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection); //--- hide (true) or display (false) graphical object name in the object list ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden); //--- set the priority for receiving the event of a mouse click in the chart ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order); //--- successful execution return(true); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { Print(__FUNCTION__); ObjectsDeleteAll(0,OBJ_ARROW); ChartRedraw(); } //+------------------------------------------------------------------+
kapoo: Below is what have tried but am still having issue on it.
- Three posts and you still haven't stated a problem. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't
start, won't go in gear, no electrical, missing the key, flat tires -
meaningless. There are no mind readers here.
const uchar arrow_code=203, if(!ObjectCreate(chart_ID,name,OBJ_ARROW_UP,sub_window,time,price)) ... ObjectSetInteger(chart_ID,name,OBJPROP_ARROWCODE,arrow_code);
You can't set a arrow code, for non-arrow objects.OBJPROP_ARROWCODE
Arrow code for the Arrow object
char
- I already said "There are only a few choices Standard
Constants, Enumerations and Structures / Objects Constants / Object
Types - Reference on algorithmic/automated trading language for
MetaTrader 5 unless you use an OBJ_ARROW" Did you look at the links I provided?
ID
Description
ID
Description
Thumbs Up
Left Price Label
Thumbs Down
Right Price Label
Arrow Up
Buy Sign
Arrow Down
Sell Sign
Stop Sign
Arrow
Check Sign
Those are your only options.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Am trying to change the signal symbol, I want another symbol instead of arrow.