pivots used by Thomas DeMark

#1
Dear all.. is there one of you to help me to rewrite this Metatrader formula to Amibroker.... Thanks in advace




//+------------------------------------------------------------------+
//| DialyPivot.mq4 |
//| These are the main pivots used by Thomas DeMark |
//| Written by: Ice |
//| |
//+------------------------------------------------------------------+
#property copyright "2005 Free software for trader"

#property indicator_chart_window
#property indicator_buffers 7

#property indicator_color1 Blue
#property indicator_color2 Yellow
#property indicator_color3 Red
#property indicator_color4 Green
#property indicator_color5 Lime

//---- input parameters\

datetime BT[];
double YesterdayHigh[50];
double YesterdayLow[50];
double YesterdayClose[50];
//---- buffers

double PivotArray[];
double R1Array[];
double S1Array[];
double R2Array[];
double S2Array[];
double R3Array[];
double S3Array[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
// Pivot
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,PivotArray);
IndicatorShortName("TDPivot");
SetIndexLabel(0,"Pivot");

// Resistance 1
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,R1Array);
SetIndexLabel(1,"R1");

// Support 1
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,S1Array);
SetIndexLabel(2,"R1");

// Resistance 2
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,R2Array);
SetIndexLabel(3,"R2");

// Support 2
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(4,S2Array);
SetIndexLabel(4,"S2");


return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();

ArrayResize(BT, Bars); Print("Bars = " + Bars);
// Fill BT with bar open TIME
ArrayCopySeries(BT, MODE_TIME);
// Fill temp arrays with High, Low and Close prices per day
ArrayCopySeries(YesterdayHigh, MODE_HIGH, Symbol(), PERIOD_D1);
ArrayCopySeries(YesterdayLow, MODE_LOW, Symbol(), PERIOD_D1);
ArrayCopySeries(YesterdayClose, MODE_CLOSE, Symbol(), PERIOD_D1);

int od = 0;
int dd = 0;


double Pivot;
double R1;
double S1;
double R2;
double S2;

//Cycle through all the bars and fill the indicator bars with the Pivot point values
for (int i = 0; i <= Bars; i++) {
if (TimeDay(BT) != od) {
dd++;
Pivot = (YesterdayHigh[dd] + YesterdayLow[dd] + YesterdayClose[dd])/3;
R1 = (2*Pivot)-YesterdayLow[dd];
S1 = (2*Pivot)-YesterdayHigh[dd];
R2 = Pivot-S1+R1;
S2 = Pivot-R1+S1;
od = TimeDay(BT);
}

PivotArray = Pivot;
R1Array=R1;
S1Array=S1;
R2Array=R2;
S2Array=S2;
}
//----
return(0);
}
//+------------------------------------------------------------------+
 

chintan786

Well-Known Member
#2
Hi Abdul.. can u upload a pic of this indicator.... looks like some Pivot point play....if it is tht then i have one afl.

chintan786
 
V

vvvv

Guest
#3
go to amibroker.com & search for demark pivots..its there...i feel the metatrader one is wrong...
 

HULK

Active Member
#7
/*De Mark's Range Projection */

/* AFL code by Prakash Shenoi */

MaxGraph=3;
rph1=(H+C+2*L)/2-L;
rph2=(2*H+L+C)/2-L;
rph3=(H+L+2*C)/2-L;
rpl1=(H+C+2*L)/2-H;
rpl2=(2*H+L+C)/2-H;
rpl3=(H+L+2*C)/2-H;
rph=IIf((C<O),rph1,IIf((C>O),rph2,IIf((C=O),rph3,0)));
rpl=IIf((C<O),rpl1,IIf((C>O),rpl2,IIf((C=O),rpl3,0)));
Graph0=rph;
Graph1=rpl;
Graph2=C;
Graph0Style=Graph1Style=16+8;
Graph2Style=128;
Graph2Color=3;
Title=Name() + ", Close " + WriteVal(( Graph2 ),1.2)+ " DeMark's Range Projection - Proj-H " + WriteVal(( Graph0),1.2) + ", Proj-L " + WriteVal(( Graph1 ),1.2);
 

Similar threads

Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

Name:Phone:
Email:City:
State:
Are you a day trader?