Latest News

2022 Start working on a new website

BBS Trading Expert
Watch the Youtube BBS video and here is a crude oil trading example

 

Want to know more about:

NinjaTrader formulas.

MetaStock formulas.

MetaTrader formulas.

My YouTube videos.

AXIOM business books awards, bronze medal! Thank You!

No longer available!

 

 

Favorite articles in 2010, 11, 12, 14 and 2015 S&C Readers' Choice Awards.

readers choice awards

AXIOM Business Books Awards, bronze medal.

AXIOM award

 

 

 

 


 

MetaTrader Formulas

HOME   Back to MetaTrader Formulas Overview

SveHighLowZigZagTicks indicator

This indicator mainly used to help you count waves applied in the V-Trade method published in Stocks & Commodities Magazine.

 

DOWNLOAD the MQL4 source code HERE

DOWNLOAD the Compiled ex4 code HERE

 

Special offer: "Capturing Profit with technical Analysis"

//+------------------------------------------------------------------+
//| SveHLZigZagTicks.mq4 |
//| Copyright © 2008, Sylvain Vervoort |
//| http://stocata.org/ |
//+------------------------------------------------------------------+

// ATTENTION!
// The first section is not drawn because the highest high or lowest low are not relevant
// The previous section is drawn when current section is confirmed

#property copyright "©2008-2018, Sylvain Vervoort"
#property link "http://stocata.org/"
#property description "Price ZigZag indicator based on a Tick size"
#property description "input value. Aid for waves counting 2018 V1.3"
#property description "ATTENTION!"
#property description "Last section only drawn after current reversal"
#property strict

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Goldenrod
#property indicator_width1 2
#property indicator_style1 STYLE_SOLID

extern int NumberOfTicks = 200; // Reversal Number of Ticks

int CurrentTrend, flat;

//--------buffers
double LastLow [];
double LastHigh [];
double ZZTemp [];
double ZigZagFinal[];

//+------------------------------------------------------------------+
//| SveHLZigZagTicks indicator initialization function |
//+------------------------------------------------------------------+
int OnInit(void)
{
IndicatorBuffers(4);
SetIndexBuffer (0,ZigZagFinal);
SetIndexStyle (0,DRAW_SECTION);
SetIndexBuffer (1,ZZTemp);
SetIndexStyle (1,DRAW_NONE);
SetIndexBuffer (2,LastHigh);
SetIndexStyle (2,DRAW_NONE);
SetIndexBuffer (3,LastLow);
SetIndexStyle (3,DRAW_NONE);

//---- name for data Window and indicator subwindow label
string StrNumberOfTicks = IntegerToString(NumberOfTicks);

IndicatorShortName("SveHLZigZagTicks ("+StrNumberOfTicks+")");

// Check validity of the inputs
if(NumberOfTicks < 2)
{
Alert("Number of Ticks must be > 1, Default used!");
NumberOfTicks = 200;
}

CurrentTrend = 1; // just start assuming trend is up

//---- Init done
return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| SveHLZigZagTicks indicator iteration function |
//+------------------------------------------------------------------+
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[])
{
//--- last counted bar will be recounted
int limit = rates_total - prev_calculated; // differenc already calculated
if (limit < 0) return(-1); // No bars return error.
if (prev_calculated>=0) limit--; // -1 start addressing from 0
// ----------
flat = 1;

for(int i=limit-2; i>=0 && !_StopFlag; i--)
{
if (CurrentTrend > 0) // trend is up, look for new swing high
{
if (high[i] >= LastHigh[i+1])
{ // found a higher high
LastHigh[i] = high[i];
ZZTemp[i] = high[i];
}
else if (low[i] <= (LastHigh[i+1] - Point*NumberOfTicks)) // found a swing low
{
LastLow[i] = low[i];
LastHigh[i] = low[i];
ZZTemp[i] = low[i];
CurrentTrend = -1;
}
else LastHigh[i] = LastHigh[i+1]; ZZTemp[i] = LastHigh[i];
}

else // dir < 0, trend is down, look for new swing high
{
if (low[i] <= LastLow[i+1]) // found a lower low
{
LastLow[i] = low[i];
ZZTemp[i] = low[i];
}
else if (high[i] >= (LastLow[i+1] + Point*NumberOfTicks)) // found a swing high
{
LastHigh[i] = high[i];
LastLow[i] = high[i];
ZZTemp[i] = high[i];
CurrentTrend = 1;
}
else LastLow[i] = LastLow[i+1]; ZZTemp[i] = LastLow[i];
}

ZigZagFinal[i] = EMPTY_VALUE;
if (ZZTemp[i+flat] < ZZTemp[i+flat+1] && ZZTemp[i] > ZZTemp[i+1])
ZigZagFinal[i+flat] = low[i+flat];
else if (ZZTemp[i+flat] > ZZTemp[i+flat+1] && ZZTemp[i] < ZZTemp[i+1])
ZigZagFinal[i+flat] = high[i+flat];

if (ZZTemp[i] == ZZTemp[i+1]) flat = flat+1;
else flat = 1;
}
//----
return(rates_total);
}

//+-------------------------------------END OF PROGRAM---------------------------+

 
Search the Internet

 

HOME   Back to MetaTrader Formulas Overview


 
 

Risk Disclosure: Futures and forex trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones’ financial security or life style. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.

Hypothetical Performance Disclosure: Hypothetical performance results have many inherent limitations, some of which are described below. no representation is being made that any account will or is likely to achieve profits or losses similar to those shown; in fact, there are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. One of the limitations of hypothetical performance results is that they are generally prepared with the benefit of hindsight. In addition, hypothetical trading does not involve financial risk, and no hypothetical trading record can completely account for the impact of financial risk of actual trading. for example, the ability to withstand losses or to adhere to a particular trading program in spite of trading losses are material points which can also adversely affect actual trading results. There are numerous other factors related to the markets in general or to the implementation of any specific trading program which cannot be fully accounted for in the preparation of hypothetical performance results and all which can adversely affect trading results.

See more 'Legal Disclosures' in the bottom menu bar!

Copyright © 2007 Stocata.org, All rights reserved.
-->