how to defined highest, lowest ?
You need to decide the Highest high and Lowest low of x number of bars.
Best example is the Zigzag indicator !.
As a code, you may use something like this ...
HH = NormalizeDouble(iHigh(Symbol(), TimeFrame, iHighest(Symbol(), 0, MODE_HIGH, NoOfBars, 1)), Digits); LL = NormalizeDouble(iLow(Symbol(), TimeFrame, iLowest(Symbol(), 0, MODE_LOW, NoOfBars, 1)), Digits);
You need to decide the Highest high and Lowest low of x number of bars.
Best example is the Zigzag indicator !.
As a code, you may use something like this ...
being search around on internet,
this is what i found.
int n, i; double zag, zig; i=0; while(n<2) { if(zig>0) zag=zig; zig=iCustom(NULL, 0, "ZigZag", 0, i); if(zig>0) n+=1; i++; }now you have two numbers zig -- last value and zag -- value before that if(zag>zig) indicator shows down if(zig>zag) indicator shows up
2016.08.30 12:39:03 Core 1 2010.01.01 00:00:00 cannot load custom indicator 'ZigZag' [4802]
it seems is wrong coding.
void OnTick() { //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ if(ZigZag_Handle != INVALID_HANDLE) { double values[]; if(CopyBuffer(ZigZag_Handle, 0, 0, 2, values) == 2 && values[0] != EMPTY_VALUE) { if(GlobalVariableSet("ZigZag_Handle", values[0])) { if(!IndicatorRelease(ZigZag_Handle)) { Print("IndicatorRelease() failed. Error ",GetLastError()); } else ZigZag_Handle = INVALID_HANDLE; } else { Print("GlobalVariableSet failed. Error ",GetLastError()); } } } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ }
int OnInit() { //+------------------------------------------------------------------+ //+-- create timer --------------------------------------------------+ EventSetTimer(60); //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ ZigZag_Handle = iCustom(Symbols, PERIOD_CURRENT, "ZigZag", ExtDepth, ExtDeviation, ExtBackstep); //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ return(INIT_SUCCEEDED); }
//+--- int ZigZag_Handle = INVALID_HANDLE; int ExtDepth = 6; int ExtDeviation = 3; int ExtBackstep = 2; //+---
Please use the search function.
super thanks for the solution.
great thanks !!

and how to get it ?
confusing...
buy low sell high
seems is the easy job
but how to ensure that point is highest or lowest ?