I'm brand new to coding. I found a course on Udemy that is really helpful but when I want to do something that the course doesn't cover, I
really struggle to understand the MQL4 Docs. For example, it doesn't cover adding objects to the chart. Right now I'd like to
add a simple vertical line whenever the stochastics indicator crosses above the 80 or below 20.
As I look online I see people drawing vertical lines in all these different conditions but I'm having a hard time simplifying it to do what I
Could someone show me an example of the most basic form of adding an object? There are so many options that I think I'm a little
overwhelmed. In the code below I am trying to draw a vertical line when stochastics crosses over 80. I created a variable for the
upper and lower line so I can adjust them later as intern variables. I created that candleCount variable because I read somewhere that
multiple lines can't be drawn unless their name is different. I think I saw someone write the name in this way before.
This is all making my head spin. I feel like I will be so well off if I can just see a basic example of how to add a vertical line, what the
necessary inputs are and then I can tweak them and build on that as I learn.
Any help is appreciated.
double stochUpper = 80;
double stochLower = 20;
double stochShift2 = NormalizeDouble(iStochastic(NULL,0,14,3,3,0,0,MODE_MAIN,2),4);
double stochShift1 = NormalizeDouble(iStochastic(NULL,0,14,3,3,0,0,MODE_MAIN,1),4);
int candleCount = 0;
if(stochShift1 > 80 && stochShift2 < 80)
ObjectCreate("Line" + candleCount,OBJ_VLINE,0,0,0,0);
Try this instead.
ObjectCreate("Line" + candleCount,OBJ_VLINE,0,Time,0);
Thanks mt4ski! That made the difference. On that line, which input changes the colour? I'm trying to create a vertical line
that is one colour for oversold and another for overbought. Your help is very appreciated!
I tried looking in the docs but there are a couple pages of code examples that don't seem to look anything like the simple line you