NexusFi: Find Your Edge


Home Menu

 





15 min and 60 min MA on 5 min chart


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one SanSan with 1 posts (0 thanks)
    2. looks_two wayner with 1 posts (0 thanks)
    3. looks_3 rmejia with 1 posts (2 thanks)
    4. looks_4 jjjann with 1 posts (1 thanks)
    1. trending_up 8,740 views
    2. thumb_up 3 thanks given
    3. group 4 followers
    1. forum 4 posts
    2. attach_file 1 attachments




 
Search this Thread

15 min and 60 min MA on 5 min chart

  #1 (permalink)
SanSan
Singapore
 
Posts: 1 since Dec 2015
Thanks Given: 0
Thanks Received: 0

Hi, I am looking for a thinkorswim study for 60 min 20 bar EMA on 5 min chart.
In tradestation, the coding is as below;

Inputs: length(20);
If CurrentBar = 240 then Value1 = xaverage(C,240);
If CurrentBar >240 then begin
If Fracportion((time- -30)/100)= =0 or time =1315 then begin
value1 = =value1[1] + (2 / (Length+ 1))*( C - value1[1]);
Value2 = value1;
Plot1(value1, "60min 20EMA");
end
else begin
Value2 = value1 + (2 / (Length + 1 )) * ( C - value1[1]);
Plot1(value2, "60 min 20EMA");
end;end;


Thanks,

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
33 thanks
Just another trading journal: PA, Wyckoff & Trends
26 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
19 thanks
  #2 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441

There is a built in study "DailySMA" that does this but only SMA. I edited that one to EMA; attached is the study.

 
Code
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input length = 9;
input displace = 0;
input showOnlyLastPeriod = no;

plot DailyEMA;

if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
    DailyEMA = Double.NaN;
} else {
    DailyEMA = ExpAverage(fundamental(price, period = aggregationPeriod)[-displace], length);
}

DailyEMA.SetDefaultColor(GetColor(1));
DailyEMA.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Attached Files
Elite Membership required to download: _DailyEMASTUDY.ts
Reply With Quote
Thanked by:
  #3 (permalink)
jjjann
Bangkok
 
Posts: 5 since Jan 2016
Thanks Given: 0
Thanks Received: 1


input price = close;
input displace = 0;
input length = 21;
input period = AggregationPeriod.FIFTEEN_MIN;
input averageType = AverageType.Simple;

plot MA = MovingAverage(averageType, close(period = period) [-displace], length = length);

Reply With Quote
Thanked by:
  #4 (permalink)
fefo
Ciudad de la costa
 
Posts: 1 since May 2018
Thanks Given: 1
Thanks Received: 0

Thanks! I wanted to show 2 moving averages so I adapted the code learning from other examples. Hope it helps someone else:

input price = close;
input displace = 0;
input length1 = 200;
input length2 = 100;
input period = AggregationPeriod.DaY;
input averageType = AverageType.Simple;

plot MA1 = MovingAverage(averageType, close(period = period) [-displace], length = length1);

plot MA2 = MovingAverage(averageType, close(period = period) [-displace], length = length2);

Reply With Quote
  #5 (permalink)
wayner
Bismarck ND/USA
 
Posts: 1 since Jan 2017
Thanks Given: 0
Thanks Received: 0

First post on the site.

Can anyone convert these 2 TradeStation EasyLanguage code indicators to ThinkorSwim

Thanks Wayne

EasyLanguage for indicators

TradeStation’s EasyLanguage that very accurately plot the 15 and 60 minute EMAs on the 5 minute chart

15 minute EMA plotted on a 5 minute chart
Inputs: length(20);
If CurrentBar = 60 then Value1 = xaverage(C, 60);
If CurrentBar > 60 then begin
If Fracportion(time/15) = 0 then begin
value1 = value1[1] + (2 / ( Length + 1 )) * ( C – value1[1] );
Value2 = value1;
Plot1(value1, “15 min 20EMA”);
end
else begin
Value2 = value1 + (2 / ( Length + 1 )) * ( C – value1[1] );
Plot1(value2, “15 min 20EMA”);
end;end;

60 minute EMA plotted on a 5 minute chart
Inputs: length(20);
If CurrentBar = 240 then Value1 = xaverage(C, 240);
If CurrentBar > 240 then begin
If Fracportion((time – 30)/100) = 0 or time =1315 then begin
value1 = value1[1] + (2 / ( Length + 1 )) * ( C – value1[1] );
Value2 = value1;
Plot1(value1, “60 min 20EMA”);
end
else begin
Value2 = value1 + (2 / ( Length + 1 )) * ( C – value1[1] );
Plot1(value2, “60 min 20EMA”);
end;end;

Reply With Quote




Last Updated on December 8, 2019


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts