Measuring the price difference between a line and a bar

 

I know that you can measure the difference in price between the current price and moving average. And there are several other objects that can be used for this sort of calculation. But is there any form of a straight line that can be used to measure this difference? In particular I'm working with OBJ_STDEVCHANNEL which does not allow for this type of calculation. I would like to measure the distance in pips from the current price to either the high or low standard deviation straight line.

Thanks

 
MisterDog:

I know that you can measure the difference in price between the current price and moving average. And there are several other objects that can be used for this sort of calculation. But is there any form of a straight line that can be used to measure this difference? In particular I'm working with OBJ_STDEVCHANNEL which does not allow for this type of calculation. I would like to measure the distance in pips from the current price to either the high or low standard deviation straight line.

Thanks

It's not easy to do that. There's plenty Standard Deviation Channel CI here in this forum that does not utilize Object, try iRegr with degree = 1.

Good luck.

 
MisterDog:

I know that you can measure the difference in price between the current price and moving average. And there are several other objects that can be used for this sort of calculation. But is there any form of a straight line that can be used to measure this difference? In particular I'm working with OBJ_STDEVCHANNEL which does not allow for this type of calculation. I would like to measure the distance in pips from the current price to either the high or low standard deviation straight line.

You pretty much have to do the work yourself with the regression line and standard deviation objects. They look nice on the charts but don't tell you what you want to know!

You could of course use a Bollinger band indicator (using iBands from an EA). This is not what you asked for, but would be a simpler alternative since you can read the upper and lower band values directly. If that is not acceptable then lift the regression line code from one of the indicators in the code base, use iStdDev to get the standard deviation, and you're nearly there.

 

I think I get it: any of the technical indicators like iMA, iBands, iEnvelopes can be used for calculations on their lines but they cannot be drawn in an EA. However, all of the ObjectCreate functions can be drawn in the EA but their lines can not be use for calculations.

I wonder if capture my own array and use something like iBandsOnArray. Will that draw an object in an EA that can be used for calculations? Back to the drawing board -- I'll give it a try.

 
MisterDog:

I wonder if capture my own array and use something like iBandsOnArray. Will that draw an object in an EA that can be used for calculations?

No, it won't draw anything.
 
Drat! I guess if I want to see what my calculations are doing I have to go back to creating an Indicator and use iCustom.
 
MisterDog:
Drat! I guess if I want to see what my calculations are doing I have to go back to creating an Indicator and use iCustom.
Not quite. You can draw objects with the EA, so you can draw a regression line, for example. If you use standard indicators then you can use iBands or whatever, and then use the standard indicator on the chart using a template.
 
A Template. That's new to me. Okay I'm off to study templates at, MetaEditor:Templates as a Spot to Stand On
Reason: