Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 12/16/2004 Posts: 14
|
I have ask this before but have never received a real answer. have tried numerous times to create a simple indicator in SF. in real code i am using the following code: Plot = ((price.maxlow(1)+price.maxlow(2)+price.maxlow(3))/3)......to plot the average max low for last three bars, not including current bar. I have no idea how it is calculaing the plot, but it generally plots the low of the current bar on the last 2 plots and something different for other plots. have used the SF reset numerous times, to no avail. Could someone PLEASE tell me what I am doing wrong.
dg
|
|
Worden Trainer
Joined: 4/26/2007 Posts: 508
|
gunnels,
Is the value you're wanting to plot really the average lowest low price value of each of the last three bars not including today? I think the problem you're running into is using maxlow instead of just low if that's the case.
Let us know,
Julia
|
|
Registered User Joined: 12/16/2004 Posts: 14
|
I tried using low at first but the results are the same. I am simply trying to plot the average low of the previous 3 bars. Again, the plot shown is todays low on the current bar, the days low on the previous bar, and some number, I dont know how it comes uup with it on the 3rd bar.
i dont think i am writing the code wrong, it's not that hard, but something isnt working right.
Help.
|
|
Worden Trainer
Joined: 4/26/2007 Posts: 508
|
gunnels,
Try this:
plot =( price.low(1) + price.low(2) + price.low(3)) / 3
That should take care of it. To unravel the mystery - when you use maxlow(3) for instance that returns the value of the lowest low over the past three bars. That's not what you want - what you want is to take an average of three individual bars.
Hope that helps -
Julia
|
|
Registered User Joined: 12/16/2004 Posts: 14
|
Julia,
i used the low as you suggested. This time it worked, but orginally i was using the low, i got the same incorrect answer. i dont understand what is going on, but something is, as It may well work now but not tomorrow! I know this sounds crazy, but that is whats happening
|
|
Worden Trainer
Joined: 4/26/2007 Posts: 508
|
gunnels,
Glad to hear it worked this time - we're here if for some reason it stops. Keep us posted. If there's something systematically wrong, this is a great place to report it.
Best,
Julia
|
|
Guest-1 |