NexusFi: Find Your Edge


Home Menu

 





TOS script help - crossover with alerts - help please?


Discussion in ThinkOrSwim

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




 
Search this Thread
  #1 (permalink)
 hautetoddy 
houston
 
Experience: Intermediate
Platform: ThinkOrSwim
Trading: futures
Posts: 4 since Sep 2013
Thanks Given: 2
Thanks Received: 1

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


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
No book, only a stair: journaling fills where price move …
Cryptocurrency
EA
Platforms and Indicators
My Rant with AMP Futures
Trading Reviews and Vendors
Trump Media to sell instant access to market-moving soci …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Mes vs MNQ
6 thanks
NexusFi site changelog and issues/problem reporting
5 thanks
BERN ALGOS algo trading journal
3 thanks
TopStep Trader disappointment
2 thanks
Johnnys Journal
2 thanks
  #2 (permalink)
chtulhu
Nashville+Tennessee
 
Posts: 8 since Feb 2020
Thanks Given: 1
Thanks Received: 3

here is a simple alert:

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

Look in the documetation!


Reply With Quote




Last Updated on July 12, 2020


© 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