I would like to print a red square (small) on the chart when the next higher time frame is going down. And a white square if it is going up.
How do I do that? Once I get that figured out, I can then add other time frames and different bars.
my code so far is:
// 30 min current
double open.30.0 =iCustom(NULL,30,"Heiken Ashi",0,2,0); //Previous Open
double close.30.0 =iCustom(NULL,30,"Heiken Ashi",0,3,0); //Previous Close
bool Up.30.0 = (close.30.0>open.30.0);
bool Down.30.0 = (close.30.0<open.30.0);
Comment ("\n 30 min current up or down " + Up.30.0 +" "+ Down.30.0);
But instead of the comment to have a "0" or a "1", I want it to show a red or white square or dot.
Any help would be appreciated... I can't find anything by searching this sight or the web.
Hi mrchuckw,
Search this site and other FX forums for EA's that have ObjectCreate code...
You use ObjectCreate to place colored marks where you want them.
Hope this helps,
Robert
I am using the following code... why isn't it putting a white rectangle on my chart?
ObjectCreate("square",OBJ_RECTANGLE,0,0,0);
ObjectSet("square",OBJPROP_XDISTANCE,193);
ObjectSet("square",OBJPROP_YDISTANCE,48);
ObjectSet("square",OBJPROP_COLOR,White);
I am using the following code... why isn't it putting a white rectangle on my chart?
ObjectCreate("square",OBJ_RECTANGLE,0,0,0);
ObjectSet("square",OBJPROP_XDISTANCE,193);
ObjectSet("square",OBJPROP_YDISTANCE,48);
ObjectSet("square",OBJPROP_COLOR,White);
ObjectCreate("square",OBJ_RECTANGLE, 0, datetime time1, double price1, datetime time2, double price2); ObjectSet("square",OBJPROP_COLOR,White);
You need to fill in values for . . datetime time1, double price1, datetime time2, double price2
Or maybe you want to use a Label, OBJ_LABEL and then use a wingding for the square ? https://docs.mql4.com/constants/wingdings
Ok... I think. I don't want it to be date/time oriented... I don't think.
Here's what I want. At the bottom of the chart, under the current bar, I want to place a square (wingding 110 ?) that I can fill with
red, if the next time frame up is going down, or fill with white if it is going up.
Then as that bar closes, and the next bar starts, I want the square to move under the former bar, and a new square under the new bar...
does that make sense?
so how would the ObjectCreate() line look? How do I place it on the chart where I want it, or should I use a separate window?
Thanks for your help.
Ok... I think. I don't want it to be date/time oriented... I don't think.
Here's what I want. At the bottom of the chart, under the current bar, I want to place a square (wingding 110 ?) that I can fill with
red, if the next time frame up is going down, or fill with white if it is going up.
Then as that bar closes, and the next bar starts, I want the square to move under the former bar, and a new square under the new bar...
does that make sense?
so how would the ObjectCreate() line look? How do I place it on the chart where I want it, or should I use a separate window?
Thanks for your help.
Ah OK, so you want a square under every bar, either white or red dependant on an indicator . . . don't use Objects, use Indicator buffers. ( https://docs.mql4.com/customind )
Create 2 indicator buffers, one for red squares one for white squares, set the buffers to have empty values ( SetIndexEmptyValue( int index, double value) ) to get the square under the bar use the bars Low value - 10 pips . . . this is basically what WHRoeder was getting at.
But if I set it 10 pips below the price, won't it jump around? maybe I should put it in a separate windo.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I would like to print a red square (small) on the chart when the next higher time frame is going down. And a white square if it is going up.
How do I do that? Once I get that figured out, I can then add other time frames and different bars.
my code so far is:
// 30 min current
double open.30.0 =iCustom(NULL,30,"Heiken Ashi",0,2,0); //Previous Open
double close.30.0 =iCustom(NULL,30,"Heiken Ashi",0,3,0); //Previous Close
bool Up.30.0 = (close.30.0>open.30.0);
bool Down.30.0 = (close.30.0<open.30.0);
Comment ("\n 30 min current up or down " + Up.30.0 +" "+ Down.30.0);
But instead of the comment to have a "0" or a "1", I want it to show a red or white square or dot.
Any help would be appreciated... I can't find anything by searching this sight or the web.