I am still trying to get an indicator im making to calculate correctly. I have been given great help from some other members here, and made great progress.
It is kind of working but not exactly how I wanted it to calculate.
I have come up with a new way of doing it but I have a problem with storing a variable and then changing that stored value. This will finally get it working exatcly how I want it to if its even possible to do so. I am told anything is possible with coding.
Basically I need to find out the difference in ask price on one bar to next ask price on next bar. So i do bar1 - bar2 to get the difference. I would then like to store this value. When bar 0 closes and a new bar comes in I want to calculate once again the new bar1 and bar2 difference, so doing the above calculation on these bars.
I then want to add this new value to the stored value before. Lets say the first bar1 and bar2 had a difference of 5 pips. The new bar1 and bar 2 has a difference of 10 pips.
So old stored value (5) + new value (10) = new stored value (15).
I would then like to loop through this for each new bar that closes, just adding to the stored value the difference between the new bar1 and bar2.
The way i imagine the line to look is when indicator is started it starts at a value of 0 as nothing has been calculated. Then it calculates bar1 and bar2 to give eg 5. new bar comes in, do same again but add this to previous value eg 15 etc for each new bar. So say now 10 new bars has come in since the start of indicator, the value has gone from 5 to 15,30,12, -4, -20, 2... etc.
Again help always appreciated.
It is kind of working but not exactly how I wanted it to calculate.
I have come up with a new way of doing it but I have a problem with storing a variable and then changing that stored value. This will finally get it working exatcly how I want it to if its even possible to do so. I am told anything is possible with coding.
Basically I need to find out the difference in ask price on one bar to next ask price on next bar. So i do bar1 - bar2 to get the difference. I would then like to store this value. When bar 0 closes and a new bar comes in I want to calculate once again the new bar1 and bar2 difference, so doing the above calculation on these bars.
I then want to add this new value to the stored value before. Lets say the first bar1 and bar2 had a difference of 5 pips. The new bar1 and bar 2 has a difference of 10 pips.
So old stored value (5) + new value (10) = new stored value (15).
I would then like to loop through this for each new bar that closes, just adding to the stored value the difference between the new bar1 and bar2.
The way i imagine the line to look is when indicator is started it starts at a value of 0 as nothing has been calculated. Then it calculates bar1 and bar2 to give eg 5. new bar comes in, do same again but add this to previous value eg 15 etc for each new bar. So say now 10 new bars has come in since the start of indicator, the value has gone from 5 to 15,30,12, -4, -20, 2... etc.
Again help always appreciated.