Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Help with easy language ma indicator for tradestation
Updated July 31, 2023
trending_up
343 views
thumb_up
2 thanks given
group
3 followers
forum
3 posts
attach_file
0 attachments
Help with easy language ma indicator for tradestation
July 19th, 2023, 12:21 PM
lake charles, la
Experience: Intermediate
Platform: tradestation
Trading: futures, options
Posts: 3 since Jun 2022
Thanks Given: 5
Thanks Received: 0
Found this on trading view and can't get it to work in tradestation 10.
It will change the color of the moving average depending on direction - up or down.
Can anyone help?
Quoting
//@version=4
//Color MA colors the moving average plot based on direction
//MA types are:
// 1 - simple
// 2 - exponential
// 3 - Hull
// 4 - weighted
// 5 - volume weighted
study(title = "Color MA", shorttitle="CMA", overlay = true)
length = input(9, minval=1, title="Length")
src = input(close, title="Source")
matype = input(1, minval=1, maxval=5, title="AvgType")
simplema =
sma (src,length)
exponentialma = ema(src,length)
hullma = wma(2*wma(src, length/2)-wma(src, length), round(sqrt(length)))
weightedma = wma(src, length)
volweightedma = vwma(src, length)
avgval = matype==1 ? simplema : matype==2 ? exponentialma : matype==3 ? hullma : matype==4 ? weightedma : matype==5 ? volweightedma : na
Pcolor = avgval > avgval[1] ? color.green : color.red
plot(avgval,title='Color MA', color=Pcolor, linewidth=4)
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
July 19th, 2023, 02:22 PM
Knoxville, TN/USA
Market Wizard
Experience: Beginner
Platform: TradeStation
Broker: TradeStation
Trading: ES
Frequency: Several times daily
Duration: Minutes
Posts: 623 since Feb 2010
Thanks Given: 1,562
Thanks Received: 1,364
cjshu99
Found this on trading view and can't get it to work in tradestation.
It will change the color of the
moving average depending on direction - up or down.
Can anyone help?
Here's some EL code that is similar. It changes color based on direction and calculates the angle. That can be commented out.
Perhaps you can take this and adapt your code to get it working. This one uses "Exponential" but that can be changed.
Hope it helps.
//////////////////////////////////////////////////////////
Input: Flat (LightGray), Up(Cyan), Down(Red),
Price(Close), Length(20), Displace(0);
Variables: myPlot(0), Color(green), myAngle(0);
myPlot = XAverage(Price,Length);
plot1[Displace](myPlot, "Xavg");
if C > myPlot then
SetPlotColor[1](1, Up);
if C < myPlot then
SetPlotColor[1](1, Down);
if C = myPlot then
SetPlotColor[1](1, Flat);
if C crosses above myPlot Then
Alert( " Crossing up") ;
if C crosses below myPlot Then
Alert( " crossing down ") ;
myangle = LinearRegAngle(XAverage(Price,Length), 2);
condition1 = DrawTextOnLastBar(-999999, 2, NumToStr(myangle,2) + "*", XAverage(Price,Length), white, 0);
/////////////////////////////////////////////////////////////////////////////////////////////////////
July 19th, 2023, 03:46 PM
lake charles, la
Experience: Intermediate
Platform: tradestation
Trading: futures, options
Posts: 3 since Jun 2022
Thanks Given: 5
Thanks Received: 0
Thanks. That looks good. Will see about making it use a sma
July 30th, 2023, 11:37 PM
Washington DC
Experience: Intermediate
Platform: TradeStation
Trading: EC
Posts: 9 since Sep 2012
Thanks Given: 0
Thanks Received: 5
Inputs: Price(Close), matype(1), malength(9);
// Simple MA
if matype = 1 then Value1 = Average(Price, malength);
// Exponential
if matype = 2 then Value1 = XAverage(Price, malength);
// Hull
if matype = 3 then Value1 = HMA(Price, malength);
// Weighted
if matype = 4 then Value1 = WAverage(Price, malength);
// Vol Weighted - you can find this formula in the
// Mov Avg Volume-weighted indicator in Easy Language
if Value1 > Value1[1] then plot1(Value1, "MA", green)
else plot1(Value1, "MA", red);
You can use the properties tab to customize
Last Updated on July 30, 2023