Hi guys
I found a bit of code on Youtube that I fancied, took a screen shot and copied it. It wont compile though so I need a hand in finding whats wrong.
My goal is to create a Tick based trend thingy that subtracts the previous Tick from the current one and then plot that.
Big thanks
/Bo
Heres the video.
Heres the code. Some bits have changed from the code whilst I was trying to fix it myself
I found a bit of code on Youtube that I fancied, took a screen shot and copied it. It wont compile though so I need a hand in finding whats wrong.
My goal is to create a Tick based trend thingy that subtracts the previous Tick from the current one and then plot that.
Big thanks
Heres the video.
Inserted Video
Heres the code. Some bits have changed from the code whilst I was trying to fix it myself
Inserted Code
#property strict
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 clrBlue
#property indicator_color2 clrRed
#property indicator_width1 2
#property indicator_width2 2
double ask[], bid[];
int Oninit()
{
SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ask);
SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ask);
return(INIT_SUCCEEDED);
}
void ShiftArray()
{
for (int n=WindowBarsPerChart()+2;n>0;n--)
{
if (ask[n] != EMPTY_VALUE); (ask[n+1] = ask[n]); (bid[n+1] = bid[n] ) //skip empty value on new candle
}
}
int OnCalculate (const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[],
const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[] )
{
ShiftArray();
ask[1]=Ask;
bid[1]=Bid;
return(rates_total);
}