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
Answer the question "What is the third datatype for the function"
ok see what you mean now :)
that was just the last iteration though. I previously had
but i just don't know how i get this to change on each new bar, hence i was trying to relate it back to "i"
Just use "i"
ok thanks, so i amended the code as below, but it still doesn't work. the LowRetracePrice or HighRetracePrice does not seem to change with each new bar, so there is still something wrong with the structure of the loop isn't there?
i have printed out the value of i, and it is counting the bars from the SwingDate[0] as i would expect, so i just need the high or the low of the "i" bar each time it changes. so i can't see what is wrong with LowRetracePrice or HighRetracePrice.
ok thanks, so i amended the code as below, but it still doesn't work. the LowRetracePrice or HighRetracePrice does not seem to change with each new bar, so there is still something wrong with the structure of the loop isn't there?
i have printed out the value of i, and it is counting the bars from the SwingDate[0] as i would expect, so i just need the high or the low of the "i" bar each time it changes. so i can't see what is wrong with LowRetracePrice or HighRetracePrice.
i have also tried counting the other way...
but that doesn't work either.
I am not sure why i don't get the correct high or low for each bar in the loop. All it outputs is the high and low from the SwingDate[0]. I thought this might be because i have declared the HighRetracePrice/LowRetarcaePrice as global variables, but even if i declare them in the function it doesn't seem to work.
please help, this issue has already taken me over a month...
Take this out of the for loop and place it before the loop.
As it stands, the first pass of the loop the if condition may not be true, but it will always be true on the second pass and so exiting the function
Take this out of the for loop and place it before the loop.
As it stands, the first pass of the loop the if condition may not be true, but it will always be true on the second pass and so exiting the function
thanks - i tried that - all that happens is that the retracebarcount then does not increase per bar, on each new bar it might increase by 5 for example. (no pattern that i can see)
also then depending on how i set the loop i either get no values for the LowRetracePrice, or the HighRetracePrice. Or sometimes it outputs the open price of the current bar for both values.
in my mind the loop should be (start; end; count direction) - in simple terms.
so the start being SwingDate[0], the end being the current bar - so for the start i= SwingDate[0]; for the end I tried "i=0",which returns no values, so I tried "i<=0" which doesn't work either. The only way to generate any value seems to be"i>=0" which makes no sense as i don't want to count past the current bar.
Either way I still don't get the LowRetracePrice or HighRetracePrice, to reflect each bars properties.
iHighest and iLowest
i mean within the context of the previous posts.
i need to compare the high or low for each bar past the swingdate and count them. I thought that i was on the right track with putting this in a loop, but despite all your help so far,I still can't get this to work. So am wondering if there is a better way to do it. I can't understand why the loop doesn't count the bars correctly,despite trying just about every iteration i can think of.