"Threaded Needle Cross" (Didi Index) alerts and MTF Scanner for TOS

Beltrame1

New member
VIP
I found this Didi Index/Indicator. It seems Odir Aguiar (the Brazilian creator) flattened the 8 simple moving average and made it the "zero line" if I am not mistaken. I believe the picture below shows it and it would be AWESOME if when they CROSS PERFECTLY (or fairly close to perfect) to have some sort of sound alert or ARROW. The TOS code is below. The idea is a stacked MA (thread) goes through the body of the same candle (Needle) including the wicks.

So for a bullish signal it would be: 3 above the 8 and 8 above the 20 and the inverse for a bearish move (if looking at it on the chart with the candles).

If the cross happens on the higher time frames (depending on the volume) it could take several days to trigger the move! From what I have noticed if the cross happens on the Daily, 4H, 1H it will take much longer to trigger, and sometimes even the 30M will take 2 days to move (pop), then the 15M and 5M, are more for intraday, but may fake you out.

He explains in one of his videos that he views the straight line as a fence separating 2 bulls (the other 2 MA`s) and when they run away from each other and there is a perfect cross, price runs big @BenTen the MA`s are 3 in blue, 8 in black and 20 in red.

Also looking for a MTF Scanner for this perfect Threaded Needle Cross and if it is a long signal or a short signal... Thank you guys! He mentions in one of his videos that he also uses the DMI for trend confirmation and Bollinger Bands as well. Any and all ideas are welcome!!

Odir Aguiar

Indicator developed by the Brazilian and analyst Odir Aguiar (Didi), consists of "Moving Averages", famously known as "Didi needles", where it allows the viewing of reversal points.

The concept is very simple, when you enter 3 Moving Averages on display, a period equal to 3, one equal to 8 and the other equal to 20, then the formation of the indicator that works in axis or line center equal to 0 (zero) appears. ). Moving averages must intersect when approaching line 0.

Pictures to illustrate it https://www.mql5.com/pt/code/1725

Didi_index (Lower Study)

Code:
input price = close;
input short_length = 3;
input mid_length = 8;
input long_length = 20;

def sEMA = ExpAverage(price, short_length);
def mEMA = ExpAverage(price, mid_length);
def lEMA = ExpAverage(price, long_length);

plot s = sEMA / mEMA - 1;
plot l = lEMA / mEMA - 1;

s.AssignValueColor(Color.GREEN);
l.AssignValueColor(Color.MAGENTA);

plot zeroline = 0;
zeroline.AssignValueColor(Color.GRAY);
 
Last edited by a moderator:

henry1224

Active member
VIP
@Beltrame1 I added Clouds

Code:
declare lower;
input price = close;
input short_length = 3;
input mid_length = 8;
input long_length = 20;

def sEMA = ExpAverage(price, short_length);
def mEMA = ExpAverage(price, mid_length);
def lEMA = ExpAverage(price, long_length);

plot s = sEMA / mEMA - 1;
plot l = lEMA / mEMA - 1;

s.AssignValueColor(Color.GREEN);
l.AssignValueColor(Color.MAGENTA);

plot zeroline = 0;
zeroline.AssignValueColor(Color.GRAY);
AddCloud(s,zeroline,Color.Green, color.yellow);
AddCloud(L,zeroline,Color.Magenta, color.yellow);
 

quijanoj44

Member
VIP
@Beltrame1 , here is a scanner when the S line crosses the L line, and viseversa:

Ruby:
declare lower;
input price = close;
input short_length = 3;
input mid_length = 8;
input long_length = 20;
input Show_Lines = yes;

def sEMA = ExpAverage(price, short_length);
def mEMA = ExpAverage(price, mid_length);
def lEMA = ExpAverage(price, long_length);

def S = sEMA / mEMA - 1;
def L = lEMA / mEMA - 1;

#s.AssignValueColor(Color.CYAN);
#l.AssignValueColor(Color.MAGENTA);

plot zeroline = 0;
zeroline.AssignValueColor(Color.GRAY);
#AddCloud(s,zeroline,Color.Green, color.yellow);
#AddCloud(L,zeroline,Color.Magenta, color.yellow);


#def Bullish =  if Show_Lines == yes then S crosses above L else no;
def Bullish = if S crosses above L then 1 else double.NaN;
plot UpArrow = Bullish;
UpArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
UpArrow.AssignValueColor(Color.CYAN);


#def Bearish =  if Show_Lines == yes then s crosses below l else no;
def Bearish = if S crosses below L then 1 else double.NaN;
plot DownArrow = Bearish;
DownArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
DownArrow.AssignValueColor(Color.MAGENTA);

So basically, the scan is identifying where the arrows are plotted:
wF7mu7j.png
 

SuryaKiranC

Well-known member
@Beltrame1 The way that I get around with MTF and Scan. Follow along the steps :)

  1. Past the following Code into a Study, not in the ThinkScript Editor in Scan Tab.
  2. Go to Scan tab clear out all Filters.
  3. Add Study as a filter
  4. Go to thinkscript editor and past the following line
  5. EMAScan().Bull is true within 2 bars (for Bull case) or EMAScan().Bear is true within 2 bars (for Bear case)
  6. select a desired time frame, Say 15m checkbox on/off depends on when you scanning and your trading strategy.
  7. Repeat step 3 - 6, only select a different timeframe for each instance, for as many instances as you want.
  8. Hit Scan.

Have Fun.

PS: I haven't verified the indicators conditions, but I think got them right, and If I do, I think the original script has the "L" and "S" reversed.

Code:
#EMAScan
# SuryaKiranC : Scanner Created on Request

input price = close;
input short_length = 3;
input mid_length = 8;
input long_length = 20;

def sEMA = ExpAverage(price, short_length);
def mEMA = ExpAverage(price, mid_length);
def lEMA = ExpAverage(price, long_length);

def s = sEMA / mEMA - 1;
def l = lEMA / mEMA - 1;

def Bear = l > 0;
def Bull = s > 0;

plot scan = (Bull or Bear);

EMAScan
 

Similar threads

Top