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
When creating a simple indicator to create and draw standard deviation channels or Regression Lines, and then attempting to retrieve values from the lines drawn using ObjectGetValueByShift(string name,shift), the values returned do not match the values "moused over." Also, there is apparently no way to retrieve values from the standard deviation channel lines, no values are displayed when these lines are moused over. Is this the intended design, or perhaps a bug, or my poor code work? Thanks for your efforts, MT4 is magnificent! Code used follows...
//+------------------------------------------------------------------+ //| Standard Deviation Channels.mq4 | //| Copyright © 2006, tageiger, aka fxid10t@yahoo.com | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, tageiger, aka fxid10t@yahoo.com" #property link "http://www.metaquotes.net" #property indicator_chart_window extern int STD.Rgres.period=0; /*default 0 means the channel will use the open time from "x" bars back on which ever time period the indicator is attached to. one can change to 1,5, 15,30,60...etc to "lock" the start time to a specific period, and then view the "locked" channels on a different time period...*/ extern int STD.Rgres.length=56; // bars back regression begins extern double STD.Rgres.width=1.618;// widest channel extern double STD.width=0.618; // inside channel int init() { return(0);} int deinit() { ObjectDelete("regression channel "+STD.Rgres.period);ObjectDelete("std channel "+STD.Rgres.period);return(0);} int start() { //to refresh properly delete old objects... ObjectDelete("regression channel "+STD.Rgres.period);ObjectDelete("std channel "+STD.Rgres.period); //widest channel ObjectCreate("regression channel "+STD.Rgres.period,OBJ_STDDEVCHANNEL,0,iTime(Symbol(),STD.Rgres.period,STD.Rgres.length), Close[STD.Rgres.length],Time[0],Close[0]); ObjectSet("regression channel "+STD.Rgres.period,OBJPROP_DEVIATION,STD.Rgres.width); ObjectSet("regression channel "+STD.Rgres.period,OBJPROP_COLOR,Red); ObjectSet("regression channel "+STD.Rgres.period,OBJPROP_RAY,true); //inside channel ObjectCreate("std channel "+STD.Rgres.period,OBJ_STDDEVCHANNEL,0,iTime(Symbol(),STD.Rgres.period,STD.Rgres.length), Close[STD.Rgres.length],Time[0],Close[0]); ObjectSet("std channel "+STD.Rgres.period,OBJPROP_DEVIATION,STD.width); ObjectSet("std channel "+STD.Rgres.period,OBJPROP_COLOR,Blue); ObjectSet("std channel "+STD.Rgres.period,OBJPROP_RAY,true); Print("regression channel "+STD.Rgres.period," ", ObjectGetValueByShift("regression channel "+STD.Rgres.period,0)); return(0);}//end start //+------------------------------------------------------------------+