OmniTrader Forum - OmniTrader General Discussion
How do I offset a Moving Average

^ Top
Rean

Posts: 105

Joined: 8/30/2013
Location: Johannesburg, South Africa

User Profile
 
Subject : How do I offset a Moving Average
Posted : 10/21/2022 9:19 AM
Post #48726

Hi. I want to offset a MA (or EMA) by 5 points. How does one do this with Omnitrader?

Can it be done as a quick indicator?
^ Top
Barry Cohen

Posts: 6338

Joined: 1/19/2004

User Profile
 
Subject : RE: How do I offset a Moving Average
Posted : 10/21/2022 11:10 AM
Post #48727 - In reply to #48726

Yes, you can do that in a Quick Indicator...

EMA(25) + 5

or

EMA(25) - 5

Depending what offset direction you want.


^ Top
Rean

Posts: 105

Joined: 8/30/2013
Location: Johannesburg, South Africa

User Profile
 
Subject : RE: How do I offset a Moving Average
Posted : 10/21/2022 11:17 AM
Post #48728 - In reply to #48726

Thanks Barry

I tried it but it's not working. See the attached snippet. The bottom red SMA is the SMA(20), the top is SMA(20)+5.

This is what the quick indicated text file looks like:

#Indicator

Dim fValue As Single

fValue = SMA(20)+5
PlotPrice("Value", fValue)

Return fValue
Attached file : SMA_offset.jpg (51KB - 185 downloads)
Attached file : SMA_offset.jpg (51KB - 188 downloads)

^ Top
Rean

Posts: 105

Joined: 8/30/2013
Location: Johannesburg, South Africa

User Profile
 
Subject : RE: How do I offset a Moving Average
Posted : 10/24/2022 8:18 AM
Post #48729 - In reply to #48728

Just to add to the description. The intention is to offset a moving average to the left or right.
^ Top
Barry Cohen

Posts: 6338

Joined: 1/19/2004

User Profile
 
Subject : RE: How do I offset a Moving Average
Posted : 10/24/2022 12:03 PM
Post #48730 - In reply to #48729

Ok so you mean offset left/right, not up/down? Then what do you mean by 5 points? Maybe try this instead...

EMA(25)[5]

^ Top
Rean

Posts: 105

Joined: 8/30/2013
Location: Johannesburg, South Africa

User Profile
 
Subject : RE: How do I offset a Moving Average
Posted : 10/24/2022 2:27 PM
Post #48731 - In reply to #48726

"Points" is a wrong choice of word from me. I want to shift the MA by 5 positions to the front (or back). It's a standard feature in most charting platforms such as MT4, Tradingview or cTrader. I tried the brackets and although it does seem to offset the MA, it still does not "project" it beyond the last candle. Going the other direction ([-5]) just does not yield anything at all, nothing seems to happen, and the indicator does not appear.

And when you try to edit the Quick Indicator afterwards it messes things up by placing the indicator in a New Pane as opposed to just continuing in the Plot Price Pane.


^ Top
Barry Cohen

Posts: 6338

Joined: 1/19/2004

User Profile
 
Subject : RE: How do I offset a Moving Average
Posted : 10/27/2022 11:16 AM
Post #48735 - In reply to #48731

There was an issue with editing Quick Indicators, but that was fixed in PR2K, so make sure you are updated. Shifting an indicator the other direction is not possible that I know of nor is projecting an indicator beyond the current bar, but I'll make a feature request about it.


https://www.omnitrader.com/currentclients/otforum/thread-view.asp?threadid=16576&posts=7