NexusFi: Find Your Edge


Home Menu

 





Help needed to convert an indicator from MT4


Discussion in ThinkOrSwim

Updated
    1. trending_up 1,564 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 2 attachments




 
Search this Thread

Help needed to convert an indicator from MT4

  #1 (permalink)
 
twoodman's Avatar
 twoodman 
Brisbane, QLD / Australia
 
Experience: Intermediate
Platform: Ninja, TradeStation, TOS
Broker: TD Ameritrade
Trading: Crude CL
Posts: 17 since Aug 2009
Thanks Given: 5
Thanks Received: 21

Hi All,

Please can you help me convert this indicator from MT4 to TOS. I would be forever in your debt. I don't need the alerts. Thank you.

Attached Files
Elite Membership required to download: Waddah_Attar_Explosion.mq4
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
What broker to use for trading palladium futures
Commodities
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #2 (permalink)
SolidChicken
Singapore
 
Posts: 1 since Aug 2019
Thanks Given: 23
Thanks Received: 0

Hi Twoodman, here's the script. (Removed the hash sign at the bottom of the script if wanna get the price color same as the study)


declare lower;
input sensitivity = 150; #"Sensitivity"
input fastLength = 20; #"FastEMA Length"
input slowLength = 40; #"SlowEMA Length"
input channelLength = 20; #"BB Channel Length"
input mult = 2.0; #"BB Stdev Multiplier"
#input deadZone = 20; #"No trade zone threshold"

script calc_macd{

input source = close;
input fastLength = 20;
input slowLength = 40;

def fastMA = movAvgExponential(source, fastLength);
def slowMA = movAvgExponential(source, slowLength);

plot out = fastMA - slowMA;

}

script calc_BBUpper{

input source = close;
input length = 20;
input mult = 2.0;

def basis = simpleMovingAvg(source, length);
def dev = mult * stdev(source, length);

plot out = basis + dev;

}

script calc_BBLower{

input source = close;
input length = 20;
input mult = 2.0;

def basis = simpleMovingAvg(source, length);
def dev = mult * stdev(source, length);

plot out = basis - dev;

}

def t1 = (calc_macd(close, fastLength, slowLength) - calc_macd(close[1],
fastLength, slowLength)) * sensitivity;

def t2 = (calc_macd(close[2], fastLength, slowLength) -
calc_macd(close[3], fastLength, slowLength)) * sensitivity;

def e1 = (calc_BBUpper(close, channelLength, mult) - calc_BBLower(close,
channelLength, mult));

#//
def e2 = (calc_BBUpper(close[1], channelLength, mult) - calc_BBLower(close[1], channelLength, mult));

def trendUp = if t1 >= 0 then t1 else 0;
def trendDown = if t1 < 0 then (-1 * t1) else 0;

plot tUp = trendUp; #"UpTrend"
tUp.setpaintingStrategy(paintingStrategy.HISTOGRAM);
tUp.assignValueColor(if trendUp < trendUp[1] then color.white else
color.green);
tUp.setLineWeight(5);

plot tDn = trendDown; #"DownTrend"
tDn.setpaintingStrategy(paintingStrategy.HISTOGRAM);
tDn.assignValueColor(if trendDown < trendDown[1] then color.orange else
color.red);
tDn.setLineWeight(5);

plot ex = e1; #"ExplosionLine"
ex.setdefaultColor(createColor(160, 82, 45));
ex.hideTitle();

#plot xLine = deadZone; #"DeadZoneLine"
#xLine.setdefaultColor(color.blue);

#AssignPriceColor(if trendUp < trendUp[1] then Color.WHITE else if trendUp > trendUp[1] then Color.GREEN else if trendDown > trendDown[1] then Color.red else if trendDown < trendDown[1] then Color.ORANGE else color.CURRENT);

WAE

Reply With Quote




Last Updated on April 11, 2020


© 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