//+------------------------------------------------------------------+ //| Stub_VoltyChannel_Stop_v2_EA.mq4 | //| Copyright © 2007, TrendLaboratory | //| http://finance.groups.yahoo.com/group/TrendLaboratory | //| E-mail: igorad2003@yahoo.co.uk | //| | //| How to use the VoltyChannel_Stop_v2 indicator in an EA | //+------------------------------------------------------------------+ //---- input parameters extern int Price = 0; //Applied Price: 0-C,1-O,2-H,3-L,4-Median,5-Typical,6-Weighted extern int MA_Length = 1; //MA's Period extern int MA_Mode = 0; //MA's Method:0-SMA,1-EMA,2-SMMA,3-LWMA extern int ATR_Length =10; //ATR's Period extern double Kv = 4; //Volatility's Factor or Multiplier extern double MoneyRisk = 1; //Offset Factor double UpBuffer; double DnBuffer; double UpSignal; double DnSignal; bool new_bar = false; datetime last_tick; // All buffers are double so only need one function double GetIndicatorValues(int WhichBuffer, int pos) { double res; res = iCustom(NULL, 0, "VoltyChannel_Stop_v2", Price, MA_Length, MA_Mode, ATR_Length, Kv, MoneyRisk, 0, 0, WhichBuffer, pos); return(res); } int start() { // there are function that only happen at the start of a bar if (Time[0] == last_tick) new_bar = false; else { new_bar = true; last_tick = Time[0]; } if (new_bar) { // These 4 buffers are the display buffers UpBuffer = GetIndicatorValues(0,1); // Blue Line DnBuffer = GetIndicatorValues(1,1); // Red Line UpSignal = GetIndicatorValues(2,1); // Blue Dot DnSignal = GetIndicatorValues(3,1); // Red Dot // Check for large value to see what is displayed on chart if (UpBuffer < 10000) Print ("UpTrend = ", UpBuffer); if (DnBuffer < 10000) Print ("DownTrend = ", DnBuffer); if (UpSignal < 10000) Print ("UpDot = ", UpSignal); if (DnSignal < 10000) Print ("DownDot = ", DnSignal); } }