I need example code that shows how to calculate the position of the CLOSE in relation to a diagonal line. In other words ... if I have a diagonal line (not horizontal) I need to calculate whether the bar closed above or below the diagonal line.
- Coding Problem
- Draw diagonal line in MQL4
- Erasing lines
y = m*x + b
How much information do you have about your diagonal line?
Using the line equation above, you would be comparing your close price to y. CLOSE > y is above the line, CLOSE < y is below the line.
m = ((price at beginning of diagonal line) - (price at end of diagonal line)) /(number of bars crossed by the line)
b is probably just 0.
x = bar in question (the one with the CLOSE price you want to test)
I don't have enough information to put it into code. What is this diagonal line you speak of? Is it an indicator?
maybe use the concept of 'price change per bar' as another way of looking at y = mx + b
SquareRoot:
I need example code that shows how to calculate the position of the CLOSE in relation to a diagonal line. In other words ... if I have a diagonal line (not horizontal) I need to calculate whether the bar closed above or below the diagonal line.
I need example code that shows how to calculate the position of the CLOSE in relation to a diagonal line. In other words ... if I have a diagonal line (not horizontal) I need to calculate whether the bar closed above or below the diagonal line.
ObjectGetValueByShift(objName, shift)returns the price of the line at bar shift. Compare to Close[shift]
WHRoeder:
returns the price of the line at bar shift. Compare to Close[shift]
returns the price of the line at bar shift. Compare to Close[shift]
This is what I'm looking for ... thanks
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