TOS script help - crossover with alerts - help please? - futures io
futures io futures trading

TOS script help - crossover with alerts - help please?

Discussion in ThinkOrSwim

Updated by chtulhu
    1. trending_up 474 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 replies
    2. attach_file 0 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 100,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

TOS script help - crossover with alerts - help please?

(login for full post details)
  #1 (permalink)
Experience: Intermediate
Platform: ThinkOrSwim
Trading: futures
Posts: 4 since Sep 2013
Thanks: 2 given, 1 received

Hey folks, does anyone know how to make a “study” cross on TOS? A shorter and longer MoneyFlowIndex crossover above/below with sound and arrows? I’ve tried to alter various templates they have, but getting nowhere fast. I’m happy to pay, btw. Here’s what I have so far and what i'm hoping for...

--- a short moneyflowindex study line that crosses a long moneyflowindex study line, adjustable
---- the two lines are plotted on chart
--- with alerts when cross both above/below
--- alert with arrows+sound+box
--- to simply rephrase it - when one line crosses the other, either up or down, we get alerts


here's what i have so far...

input averageType1 = MoneyFlowIndex();
input MoneyFlowIndex() = 10;
input movingAvgLength = 1;
input length1 = 15;
input movingAvgLength1 = 1;
input crossingType = {default above, below};

def tmp1 = if price > price[1] then price - price[1] else 0;
def tmp2 = if price[1] > price then price[1] - price else 0;
def d2 = Sum(tmp1, MFIlength);
def d4 = Sum(tmp2, MFIlength);
def cond = d2 + d4 == 0;
def ad3 = if cond then 0 else (d2 - d4) / (d2 + d4) * 100;
def coeff = 2 / (MFIlength + 1) * AbsValue(ad3) / 100;
def asd = CompoundValue("visible data" = coeff * price + (if IsNaN(asd[1]) then 0 else asd[1]) * (1 - coeff), "historical data" = price
def VMA = asd;

def avg1 = MovingAverage(averageType1, price, length1);
def avg2 = MFI;

plot signal = Crosses(avg1, avg2, crossingType == crossingType.above);

signal.DefineColor("Above", GetColor(6));
signal.DefineColor("Below", GetColor(7));
signal.AssignValueColor(if crossingType == crossingType.above then signal.Color("Above") else signal.Color("Below"));

signal.SetPaintingStrategy(if crossingType == crossingType.above
then PaintingStrategy.BOOLEAN_ARROW_UP
else PaintingStrategy.BOOLEAN_ARROW_DOWN);


Thank you very much for your help

Reply With Quote

(login for full post details)
  #2 (permalink)
Posts: 2 since Feb 2020
Thanks: 0 given, 0 received

here is a simple alert:

Alert(signal, " " , Alert.BAR, Sound.Ring);

Look in the documetation!

Reply With Quote

futures io Trading Community Platforms and Indicators ThinkOrSwim > TOS script help - crossover with alerts - help please?

July 12, 2020

Upcoming Webinars and Events

Dealing with burnout w/Linda Bradford Raschke

Elite only

Copyright © 2020 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