You are going to have to tell it where to place the dot.... have a look at OBJECTS
https://docs.mql4.com/objects/ObjectCreate
V
The x and Y co ordinates are the time for x and a price for y. So the x and y for the high of the prev bar would be Time[1] and High[1].
V
After hours of searching i have finally found this peace of code to draw my dot's, but it's only drawing one red dot and not a red dot over each bar that meet my critia.
string objName = "Bullseye"; if (ObjectFind(objName) != -1) { ObjectDelete(objName); } double price = High[1]; ObjectCreate(objName, OBJ_TEXT, 0, Time[1], High[1]); ObjectSetText(objName, CharToStr(159), 14, "Wingdings", Red); }
Can anyone see what wrong in my code?
double Bar1, Bar2, Buttom, Top; double OpenPrice1=Open[1]; double ClosePrice1=Close[1]; double HighPrice1=High[1]; double LowPrice1=Low[1]; double OpenPrice2=Open[2]; double ClosePrice2=Close[2]; double HighPrice2=High[2]; double LowPrice2=Low[2]; // Find high/low of the two doji bars if (HighPrice1 > HighPrice2) { Top = HighPrice1; } else { Top = HighPrice2; } if (LowPrice1 > LowPrice2) { Buttom = LowPrice1; } else { Buttom = LowPrice2; } if (( MathAbs(OpenPrice1-ClosePrice1) <= 4*Point) && ( MathAbs(OpenPrice2-ClosePrice2) <= 4*Point)) { DrawDot(); } } void DrawDot() { string objName = "TouchDown"; if (ObjectFind(objName) != -1) { ObjectDelete(objName); } double price = High[1]; ObjectCreate(objName, OBJ_TEXT, 0, Time[1], price); ObjectSetText(objName, CharToStr(159), 14, "Wingdings", Red); }
Each dot will need its own object name if you want lots of dots. Typically, that can be achieved like so..
string objName = "Bullseye"+Time[1];V
And just to expand... in your code you are using
if (ObjectFind(objName) != -1) { ObjectDelete(objName);
Which means, if the object called "objName" already exists, delete it.
V
Ohh yeah.... that works much better :) Thanks a lot!
Do you know how i can make a distance so that the red dot is not in the middle of the bar but on top of the bar with a few pips distance?
Ohh yeah.... that works much better :) Thanks a lot!
Do you know how i can make a distance so that the red dot is not in the middle of the bar but on top of the bar with a few pips distance?
Ok i have now cooked it down to this. And it works perfect. Thanks!
void DrawDot() { string objName = "Bullseye" + Time[1]; ObjectCreate(objName, OBJ_TEXT, 0, Time[1], High[1]+10*Point); ObjectSetText(objName, CharToStr(159), 14, "Wingdings", Red); }
Ok i have now cooked it down to this. And it works perfect. Thanks!
Thank you for the code! It helped me out form lots or trying!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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 have a dot on my screen everytime a specific pattern is reached.
I can see that something like this could be used:
SetIndexArrow(2, 251); // cross code in Wingdings
But i'm sure i need more code than this one line.