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
Hello FxTrader_
I'm not entirely sure what you're after but I'll give you a few pointers that may (or may not) help along the way.
But I think you're going to need to do quite a bit of reading...
This is just a minor point that makes your indicator more user friendly:
Let's assume the time is 14:00. Your code will retrieve the MAs as follows:
Let's also assume this indicator is applied to the M1 chart (i.e. not the H1 chart), so the following applies.
Close[0] = close price of 14:00 bar
Close[1] = close price of 13:59 bar
Close[2] = close price of 13:58 bar
Close[3] = close price of 13:57 bar
Your triggering logic has been written
So you are comparing the close at 13:57 to the H1 MA at 11:00, and the close at 13:58 to the H1 MA at 12:00 etc... is this what you intend?
Also, you are storing a bool (true or false) in a double variable. Is this what you want?
What is the purpose of Volume[0]==1? If you are trying to detect a new bar, as a general rule use time.
You also need to be very careful with your brackets. This code works as follows:
So you probably want this:
You will probably also want to look up some of the functions you are using. If you press F1 from MetaEditor it will open the reference for what the cursor is currently on.
This code will only draw the line on M15 and H1 charts. Is that what you want?
There is also an issue with your line names. You are trying to call your lines either 0 or 1 (i.e. whatever the value of M1_BUY_CONDITION is).
Your line will also have the same start and end points. Sort of like a dot rather than a line:
The whole IsDrawn approach was just to show how a line could be drawn in isolation - it wouldn't really be applicable here. I'm presuming you want the line(s) to be drawn whenever your criteria is met.
This is what I'm trying to do.