Home > database >  O master transformation
O master transformation

Time:11-24

Which master can help the mt4 an indicator to tongda letter?
The following source:
Red line crossing zero from above is a support breakout signal.
Green line crossing zero the from below is to hold a breakout signal.

*/

# property indicator_separate_window
# property indicator_buffers 2
# property indicator_width1 1
# property indicator_color1 Green
# property indicator_color2 Red

Extern int L=50;//Period
Extern int PriceType=1;//0 - Close, 1 - High/Low,

//Buffers
TBR_S double TBR_R [], [];

//+ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - +
//| Custom indicator initialization function |
//+ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - +
Int the init ()
{
IndicatorBuffers (2);
SetIndexBuffer (0, TBR_R);
SetIndexBuffer (1, TBR_S);

SetIndexStyle (0, DRAW_LINE, STYLE_SOLID, 1);
SetIndexStyle (1, DRAW_LINE STYLE_SOLID, 1);

SetIndexDrawBegin (0, L);
SetIndexDrawBegin (1, 1);

SetIndexEmptyValue (0, EMPTY_VALUE);
SetIndexEmptyValue (1, EMPTY_VALUE);

IndicatorDigits (who);

IndicatorShortName (" TBR (" + L + ") ");

Return (0);
}

//+ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - +
//| TradeBreakOut |
//+ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - +
Int the start ()
{
If (Bars & lt;=L) return (0);

Int counted_bars=IndicatorCounted ();
If (counted_bars & gt; 0) counted_bars -;

//the Skip calculated bars
Int the end=Bars - counted_bars;
//always calculate bars that are too close to the end, There won 't be enough bars to calculate ArrayMin/Max
If (Bars - end & lt; End==L) Bars - (L + 1);

for (int i=0; I & lt; end; I++)
{
If (PriceType==0)//Close
{
TBR_R [I]=(Close [I] - Close [ArrayMaximum (Close, L, I + 1)])/Close [ArrayMaximum (Close, L, I + 1)];
TBR_S [I]=(Close [I] - Close [ArrayMinimum (Close, L, I + 1)])/Close [ArrayMinimum (Close, L, I + 1)];
}
Else if (PriceType==1)//High/Low,
{
TBR_R [I]=(High - High [I] [ArrayMaximum (High, L, I + 1)])/High [ArrayMaximum (High, L, I + 1)];
TBR_S [I]=(Low - Low [I] [ArrayMinimum (Low, L, I + 1)])/Low [ArrayMinimum (Low, L, I + 1)];
}
}

Return (0);
}
//+ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - +
  • Related