Centered Moving Average Code - futures io
futures io futures trading

Centered Moving Average Code

Discussion in TradeStation

    1. trending_up 404 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 1 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

Centered Moving Average Code

(login for full post details)
  #1 (permalink)
Posts: 4 since Jun 2019
Thanks: 0 given, 0 received

The built in function "Mov Avg 1 Line" can plot a centered average.

This is done using the displace input which is built into the plot statement.

A 5 bar average with a displace value of 2 will plot a 5 bar centered average.

I want to create a function that will accomplish this without using a plot statement.

I want to use the centered average in a strategy where plot statements are not allowed.

Any ideas?


P.S. Attached is a plotted 5 day centered moving average in TradeStation accomplished using the plot statement.

Attached Thumbnails
Click image for larger version

Name:	CMA TradeStation.jpg
Views:	57
Size:	427.3 KB
ID:	266896  
Reply With Quote

Can you help answer these questions
from other members on futures io?
MACD line not plotting after change of plot order
Reading A set of Trading Signals
EasyLanguage Programming
Help Needed: TOS Options Chain IV & IMPL MOVE Calcul …
Second Entry Indicator (Looking for testers/feedback)
Automatic pattern research with NT
Elite Algorithmic NinjaTrader Trading
(login for full post details)
  #2 (permalink)
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received


displacing a plot will not change the value of the plot. Displaying the current value of a variable/plot two bars left or right will not change how you can access the value - it would still be the value of the current bar.
Having said that you would need to decide what historical value you need on the current bar from the average and then you can access it by back referencing the variable's value using square brackets.



Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:

futures io Trading Community Platforms and Indicators TradeStation > Centered Moving Average Code

Last Updated on June 17, 2019

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Battlestations! Show us your trading desk - $1,500 in prizes!


Importance of Finding Your Own Way w/Adam Grimes

Elite only

Journal Challenge w/Jigsaw


Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts