Convert Amibroker Make or Break (MOB) Indicator

Billy101

New member
Hi Guys,

Since this is my first post, before asking for some help I´d like to share a very useful toll (for me) to identify waves, on below link you´ll find thinkscript for Elliot Wave Oscillator with breakout bands as found on esignal, helps pretty well to identify wave 3 and wave 5.

https://indexswingtrader.blogspot.com/search?q=ElliottWaveOscillator

Now I´d like to ask for some help from more experienced users, I came across with this code that seems to be MOB indicator (another esignal), I´m a newbie on thinkscrip so if some could give a hand will be much appreciated.

Awsome forum, look forward sharing trading ideas!

Thanks!

Rich (BB code):
_SECTION_BEGIN("MOB Simulation");
SetChartOptions(0,chartShowArrows|chartShowDates);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, High %g, Low %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

//Plot Colored Candles :)
PlotOHLC(O ,H ,L ,C ,"Price",IIf(C>O,colorGreen,colorRed),styleCandle);

Offset = 5; //Recommended to use two sheets: one with 5 and another with 7, or maybe other offset value

Avgmov = Offset * MA (abs(ROC(C,1)) ,20);
per = LastValue(Avgmov) ;
numberOfBars = Cum(1);
Range = 0.01;
PS = TroughBars(L, per, 1) == 0;
Title = Title + StrFormat("AVGMOV %g|%g|%g
", Avgmov,per, numberOfBars);

xa = LastValue(ValueWhen (PS,numberOfBars,1)) ;//x from last trough
Ya = LastValue(ValueWhen (PS,L,1)) ;//y (Low) last trough

PR = PeakBars(H,per, 1) == 0;
xb = LastValue(ValueWhen (PR,numberOfBars,1)) ;//x from last peak
Yb = LastValue(ValueWhen (PR,H,1)) ;//y (High) last peak
Title = Title + StrFormat("PS %g|%g|%g|%g|%g|%g", PS,xa,ya,PR,xb,yb);

Trough_ReTest = abs((L/ya)-1) <Range;
Peak_ReTest = abs((H/yb)-1) <Range;
Trough_Cross = Cross(ya,C);
Peak_Cross = Cross(C,yb);

//UP = upSwing DN = downSwing
UP = xb>xa;//upSwing
DN = xa>xb;//DownSwing
RT23_6 = IIf(UP,yb-(yb- ya)*0.236, IIf(DN,ya+ (yb-ya)*0.236,-1e10) );
RT38_2 = IIf(UP,yb-(yb- ya)*0.382, IIf(DN,ya+ (yb-ya)*0.382,-1e10) );
RT50_0 = IIf(UP,yb-(yb- ya)*0.500, IIf(DN,ya+ (yb-ya)*0.500,-1e10) );
RT61_8 = IIf(UP,yb-(yb- ya)*0.618, IIf(DN,ya+ (yb-ya)*0.618,-1e10) );
RT78_6 = IIf(UP,yb-(yb- ya)*0.786, IIf(DN,ya+ (yb-ya)*0.786,-1e10) );

RT12_7 = IIf(UP,yb-(yb- ya)*1.27, IIf(DN,ya+ (yb-ya)*1.27,-1e10) );
RT16_1 = IIf(UP,yb-(yb- ya)*1.61, IIf(DN,ya+ (yb-ya)*1.61,-1e10) );

RT=
IIf(UP,-100* (yb-L)/(yb- ya),
100*(H-ya)/( yb-ya));//Retracement_ Value
InZone = C<yb & C>ya;//use it for filter to receive only signals that are in in the Retracement zone.
Buy = Trough_ReTest OR peak_Cross;
Sell = Peak_ReTest OR trough_Cross;
Filter = 1;
AddColumn(RT, "RT%");
AddColumn(Trough_ReTest,"TR- Test",1.0) ;
AddColumn(Peak_ReTest,"PK-Test",1.0) ;
AddColumn(Trough_Cross,"TR-Cross",1.0);
AddColumn(Peak_Cross,"PK-Cross",1.0);
//AddColumn(CdDoji( )OR CHammer(),"Candle" ,1.0);
//Plot(C,"C",1, 64);
Plot(IIf(numberOfBars>xa, ya,-1e10) ,"Bottom" ,colorBrown, 1+8);
Plot(IIf(numberOfBars>xb, yb,-1e10) ,"Top",colorBrown,1+8);
xab = IIf(xb>xa,xb, xa);
//Retracements
Plot(IIf(numberOfBars>= xab+1,RT23_6,-1e10), "R2 23.6% Retr.",5,styleLine | styleNoTitle | styleDots);
Plot(IIf(numberOfBars>= xab+1,RT38_2,-1e10), "R1 38.2% Retr.",5,styleLine | styleNoTitle | styleDots);
Plot(IIf(numberOfBars>= xab+1,RT50_0,-1e10), "ZR 50.0% Retr.",colorBlue, styleLine | styleNoTitle | styleDots);
Plot(IIf(numberOfBars>= xab+1,RT61_8,-1e10), "S1 61.8% Retr.",colorDarkRed, styleLine | styleNoTitle | styleDots);
Plot(IIf(numberOfBars>= xab+1,RT78_6,-1e10), "S2 78.6% Retr.",colorDarkRed, styleLine | styleNoTitle |styleDots);

// Plot the MOB Cloud
Plot(IIf(numberOfBars>= xab+1,RT12_7,-1e10), "127% ext.",colorBrightGreen, styleNoTitle | styleNoLabel | styleLine);
Plot(IIf(numberOfBars>= xab+1,RT16_1,-1e10), "161% ext.",colorBrightGreen, styleNoTitle | styleNoLabel | styleLine);
CondA=IIf(numberOfBars>= xab+1,RT12_7,-1e10);
CondB=IIf(numberOfBars>= xab+1,RT16_1,-1e10);
PlotOHLC(Condb,Condb,Conda,Conda,"",ColorRGB(30,130,30),styleCloud, styleNoTitle | styleNoLabel);

GraphXSpace = 0.5;

//Plot(Gauss2ord(C,5),"M5",4,1);
//GraphXSpace = 1.5;
//Title = Name()+" per = "+WriteVal(per, 1.0) +" Close = "+WriteVal(C, 1.2)+ " ("+WriteVal( ROC(C,1), 1.2)+"%)" +" Current Correction = "+WriteVal(RT, 1.0)+"%";

//Plot( Volume,"V", ParamColor("Color", colorBlueGrey ), ParamStyle( "Style", stylehidden| styleOwnScale | styleThick, maskHistogram ), 2 );
_SECTION_END( );
 
Last edited by a moderator:

rad14733

Well-known member
VIP
The code in the first post is NOT Thinkscript it is from another trading platform altogether and would need to be converted to Thinkscript to be useful... That's why you are getting multiple errors...
 
Last edited by a moderator:

Billy101

New member
[email protected] or [email protected]
Hi everyone,
I´d like to ask if what I´m trying to achieve is feasible on TOS and maybe hear if it can be done easily.
Ok, here´s the thing, there´s a tool on @dvanced 6et called MO8, make or [email protected] that allows the user to select a previous pivot and from that point a target zone in the future is drawn on the chart.
After a couple hours I found that on the Y axis (price) most of the time this area is drawn applying a fib retracement taking extensions 1.2 / 1.4 / 1.5 / 1.6 as the middle line and then adding +/- 5% and that identifies the zone.
Then you have the total lenght of the box and two timing marks (I´m working on the math on this).
For the ones interested on looking at 42 examples, here´s a list ";" separated to import in excel.

Currently I´m using this study http://tos.mx/p2FsUAl this is one of the many versions of ZigZag study, and I´d like to know if is it possible to count the swings and manually tell the code by an input variable which swing must be taken to draw a retracement from, and then plotting the zone on the forward swing.

I´m having a hard time shifting the plot

Thanks,
Billy.

9SqfV8Z.png


OCTJNL1.png


Example with GE on GET and TOS


yfpJuG9.jpg


4aHcbDX.jpg


;LongSwing;;ABSL(a-b);Duration Long;ShortSwing;;ABSC(a-b);Duration Short;Target;len MOB;;Mark#1;Mark#2
1;4,7892;9,4143;4,6251;28;9,4143;7,755;1,6593;11;1,2;;;;
2;45,907;31,294;14,613;48;31,294;39,118;7,824;17;1,5;;;;
3;29,957;41,5992;11,6422;38;41,5992;35,3;6,29920000000001;9;1,5;;;;
4;9,959;13,531;3,572;16;13,531;11,501;2,03;12;1,2;;;;
5;14,381;9,2834;5,0976;30;9,2834;11,882;2,5986;37;1,5;;;;
6;8,4462;10,799;2,3528;11;10,799;8,2985;2,5005;18;1,2;;;;
7;13,499;10,76;2,739;9;10,76;12,777;2,017;12;1,2;;;;
8;17,517;14,93;2,587;12;14,93;17,513;2,583;10;1,6;;;;
9;14,431;10,295;4,136;23;10,295;12,335;2,04;7;1,2;;;;
10;36,13;15,56;20,57;131;15,56;22,771;7,211;64;1,6;;;;
11;270,53;225,79;44,74;59;225,79;241,73;15,94;18;1,2;;;;
12;241,73;217,5;24,23;16;217,5;247,48;29,98;29;1,6;;;;
13;114,76;145,12;30,36;23;145,12;115,37;29,75;15;1,2;;;;
14;134,39;162,59;28,2;52;162,59;142,91;19,68;12;1,2;;;;
15;105,47;128,96;23,49;23;128,96;117,5;11,46;24;1,2;;;;
16;100,95;114,02;13,07;24;114,02;105,47;8,55;17;1,3;;;;
17;90,89;110,72;19,83;42;110,72;100,95;9,77;7;1,2;;;;
18;10,853;7,4183;3,4347;95;7,4183;9,0818;1,6635;30;1,6;;;;
19;4,52;7,74;3,22;16;7,74;5,74;2;23;1,2;;;;
20;8,43;13,62;5,19;48;13,62;11,14;2,48;32;1,6;;;;
21;8,67;10,91;2,24;21;10,91;9,754;1,156;23;1,3;;;;
22;9,617;11,802;2,185;34;11,802;10,194;1,608;9;1,4;;;;
23;4,5;10,893;6,393;59;10,893;6,5823;4,3107;21;1,6;;;;
24;29,16;16,724;12,436;32;16,724;24,27;7,546;38;1,4;;;;
25;12,275;26,56;14,285;49;26,56;15,14;11,42;34;1,6;;;;
26;174,09;144,37;29,72;39;144,37;179,1;34,73;25;1,2;98;;61;0
27;37,71;45,56;7,85;28;45,56;41,25;4,31;61;1,2;128;;30;52
28;121,89;157,03;35,14;81;157,03;138,07;18,96;19;1,2;69;;28;47
29;3,9061;5,3617;1,4556;66;5,3617;3,7;1,6617;137;1,2;321;;58;95
30;79,12;63,42;15,7;32;63,42;74,103;10,683;18;1,6;110;;47;77
31;144,97;165,48;20,51;27;165,48;144,84;20,64;32;1,2;111;;92;0
32;31,53;47,75;16,22;130;47,75;38,03;9,72;31;1,2;117;;69;113
33;11,33;6,59;4,74;19;6,59;8,61;2,02;16;1,2;35;;10;18
34;90,34;143,31;52,97;33;143,31;122,98;20,33;16;1,5;50;;27;46
35;486,72;272,41;214,31;56;272,41;490,76;218,35;56;1,2;184;;69;113
36;292,72;397,69;104,97;12;397,69;272,41;125,28;16;1,2;62;;25;42
37;1243,49;886,12;357,37;32;886,12;1208;321,88;9;1,4;28;;14;26
38;13,69;16,124;2,434;28;16,124;14,266;1,858;10;1,5;24;;4;8
39;152,57;134,7;17,87;32;134,7;152;17,3;24;1,6;64;;18;31
40;47348,1;39782,26;7565,84;14;39782,26;68976,48;29194,22;50;1,2;158;;50;82
41;71,999;53,823;18,176;13;53,823;70,279;16,456;17;1,4;72;;27;45
42;52,03;63,1;11,07;46;63,1;51,409;11,691;38;1,2;120;;40;66
 
Last edited by a moderator:

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top