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 rmejia with 1 posts (2 thanks)
    2. looks_two jjjann with 1 posts (1 thanks)
    3. looks_3 fefo with 1 posts (0 thanks)
    4. looks_4 SanSan with 1 posts (0 thanks)
    1. trending_up 9,571 views
    2. thumb_up 3 thanks given
    3. group 4 followers
    1. forum 4 posts
    2. attach_file 1 attachments




 
Search this Thread
  #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?
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
US Navy Blockade of Hormuz Starts Today -- Oil Surges 8p …
Prediction Markets & Event Contracts
Iran Talks Final Stages -- Two VLCCs Exit Hormuz, Record …
Traders Hideout
Memorandum Watch: How the 60-Day MOU Framework Makes May …
Prediction Markets & Event Contracts
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 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


© 2026 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 - Downloads - Top
no new posts