OmniTrader Professional Forum OmniTrader Professional Forum
forums calendars search
today this week
 
register logon control panel Forum Rules
You are currently browsing as a guest.
You should logon to access more features
A Self-Moderated Community - ALL MEMBERS, PLEASE READ!
Vote for Members who contribute the most to your trading, and help us moderate content within the Forums.


  Current location        Thread information  
OmniTrader Professional Forum
OmniLanguage Discussion
Problem with SMA of WILR indicator
Last Activity 9/5/2022 3:31 PM
11 replies, 232 viewings

Jump to page : 1
Now viewing page 1 [25 messages per page]
 
back reply
Printer friendly version

^ Top
Steelhead

Member

Posts: 13

Joined: 9/7/2012
Location: South Africa

User Profile
 
Subject : Problem with SMA of WILR indicator
Posted : 8/28/2022 2:40 PM
Post #32074

Can anybody help shine some light on what I am doing wrong?

I am trying to take the 10 period Simple Moving Average of the Williams %R indicator over 20 periods.

I have created a quick indicator SMA(WILR(20),10)

The indicator that it plots somehow has positive values, event though the WILR indicator has a range of 0 to -100.

I have included the VBA file for the QuickIndicator as well as a screenshot of the indicator on the SPY for illustration.

Thanks

I have updated the previous info with a new screenshot which shows the error more clearly as well as an omniscript for the indicator with the error.

[Edited by Steelhead on 8/29/2022 5:35 AM]

Attached file : SMA_ofWILR.png (1259KB - 21 downloads)
Attached file : SMA_of_WILR.txt (0KB - 11 downloads)
Attached file : SMA Error.png (424KB - 9 downloads)
Attached file : SMAerror.txt (0KB - 6 downloads)

^ Top
Mel

Veteran
10010025
Posts: 232

Joined: 3/18/2006

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 8/29/2022 8:34 AM
Post #32076 - In reply to #32074

I believe this is caused by the lag induced overshoot of the SMA. Try an ema or other lower lag ma.

Mel
^ Top
Jim Dean

Sage
2000100010010010010025
Posts: 3428

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 8/29/2022 9:16 AM
Post #32077 - In reply to #32076

Hmmm

Not sure how an SMA could convert a series of negative values into a positive one.
^ Top
Mel

Veteran
10010025
Posts: 232

Joined: 3/18/2006

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 9/3/2022 5:35 PM
Post #32079 - In reply to #32077

Here is what happens with overshoot induced by lag
Attached file : Screen Shot 09-03-22 at 06.34 PM.PNG (200KB - 27 downloads)

^ Top
Jim Dean

Sage
2000100010010010010025
Posts: 3428

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 9/3/2022 10:00 PM
Post #32080 - In reply to #32079

Aha. Of course. You’re right.
^ Top
Steelhead

Member

Posts: 13

Joined: 9/7/2012
Location: South Africa

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 9/4/2022 5:01 AM
Post #32081 - In reply to #32079

Hi Mel
Thanks for the response. That is very interesting. How does one import a simple list of user generated data from excel to carry out a test like you did? I assume we use the test profile and import user data features, but can't find anywhere what the CSV format of the file should be.

^ Top
Mel

Veteran
10010025
Posts: 232

Joined: 3/18/2006

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 9/4/2022 2:10 PM
Post #32082 - In reply to #32081

I just made a fake symbol and impoerted a csv file of data.

I tried an ema, it fixes your problem because it has a lot less lag.

Mel
^ Top
Mel

Veteran
10010025
Posts: 232

Joined: 3/18/2006

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 9/4/2022 2:12 PM
Post #32083 - In reply to #32074

date, O, H, L, C, V
02-20-2015,100,100, and so on
...
^ Top
Steelhead

Member

Posts: 13

Joined: 9/7/2012
Location: South Africa

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 9/4/2022 2:45 PM
Post #32084 - In reply to #32083

Thanks for the feedback. What is the process of loading the CSV file into Omnitrader, and do you happen to have a template CSV with the correct headers. I am trying some experiments on the various moving averages in Omnitrader and the results are rather wierd. I will post an example shortly.
^ Top
Steelhead

Member

Posts: 13

Joined: 9/7/2012
Location: South Africa

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 9/4/2022 3:45 PM
Post #32085 - In reply to #32084

I have calculated the Williams %R as a value between 0 and +100 (in place of the normal 0 to -100 range). I have then taken a SMA of my calculation. This indicator is labeled as SMAWorking (Omniscript attached).

The second indicator is called SMAerror and is the WILR (Williams %R) indicator from Omnitrader * -1 in order to plot in the range of 0 to +100 and has the same SMA period applied to it. (Omniscript attached)

I can see that the Omnitrader WILR and its SMA appear to have a "warmup period" where they plot nothing (as expected) then the WILR indicator seems to plot correctly, however the SMA of the value appears to be shifted on the Y axis.

In the second example the amount of bars of data was increased from 500 to 1000 and the shift of the SMA appears to have increased.
Attached file : 500barExample.png (1058KB - 13 downloads)
Attached file : 1000barExample.png (1239KB - 10 downloads)
Attached file : SMAerror.txt (0KB - 9 downloads)
Attached file : SMAWorking.txt (0KB - 7 downloads)

^ Top
Steelhead

Member

Posts: 13

Joined: 9/7/2012
Location: South Africa

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 9/5/2022 2:32 PM
Post #32086 - In reply to #32074

Hi Mel and Jim
Thanks for the help so far, I took the liberty of trying to replicate the graphs that Mel posted. I only did it for the Hull, Simple, Weighted and Exponential moving averages (see attached plots). I don't understand how the maths for a simple moving average i.e. the sum of several values divided by the number of values can give an answer greater that the largest value.

P.S. I worked out the format and method to import data into Omnitrader so ignore the question relating to that earlier.
Attached file : MovingAvgPlots.png (779KB - 19 downloads)

^ Top
Jim Dean

Sage
2000100010010010010025
Posts: 3428

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Problem with SMA of WILR indicator
Posted : 9/5/2022 3:31 PM
Post #32087 - In reply to #32086

I agree. My earlier comment in response to Mel’s “lag” post about overshoot was made in the spur of the moment without recalling the full context (about neg > pos). Apologies for any confusion.

The Williams %R values, when calculated correctly, never exceed zero.
An SMA of them will NEVER yield a positive value, if calculated correctly, nor will an EMA nor many other MA types. There are some “offbeat” MA calc’s that seek to use first or second derivatives, which could create positive values - but imo those really aren’t “averages” - they are future projections. A good example of this class of “MA” uses Linear Regression to calculate slope.

So, it appears that Nirvana’s internal formulae are doing something other than taking an SMA of a standard W%R.

[Edited by Jim Dean on 9/5/2022 3:32 PM]

Jump to page : 1
Now viewing page 1 [25 messages per page]
back reply

Legend    Action      Notification  
Administrator
Forum Moderator
Registered User
Unregistered User
E-Mail this thread to a friend
Toggle e-mail notification


Nirvana Systems
For any problems or issues please contact our Webmaster at webmaster@nirvsys.com.