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
|