|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
|
|
LinkBack | Thread Tools |
|
|
|||
|
|||
|
How to paint "Close[i]/High[i]" in seperate window?
hi everyone, when i try to draw a line of "(Close[i]-Low[i])/(High[i]-Low[i])", i get a very strange result. to my opinion, the line will wave between 0 and 1, but actual result is a straint line, i'm puzzled, can some one explain this?
here is my simple code: //----------------------------------------- #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 White double buffer1[]; int CountedBars=0; int init() { SetIndexBuffer(0,buffer1); return(0); } int start() { CountedBars=IndicatorCounted(); if(Bars<1) return(0); for(int i=Bars-CountedBars;i>=0;i--) { buffer1[i]=(Close[i]-Low[i])/(High[i]-Low[i]); } } Last edited by inssuc : 12-27-2007 at 06:43 PM. Reason: get new problem |
|
|
|||
|
|||
|
Quote:
add if( (Close[i]-Low[i]) > 0 && (High[i]-Low[i]) > 0 ) above : if( (Close[i]-Low[i]) > 0 && (High[i]-Low[i]) > 0 ) like : { if( (Close[i]-Low[i]) > 0 && (High[i]-Low[i]) > 0 ) buffer1[i]=(Close[i]-Low[i])/(High[i]-Low[i]); } |
|
|
|||
|
|||
|
thanks
it works, thanks! but i still don't understand why the condition "High[i]-Low[i]>0" is needed? can High[i]<=Low[i] in sometime?
And, the line should be painted anyway, the condition is just tell mt4 when draw when not draw, why mt4 don't draw without the condition? Last edited by inssuc : 12-27-2007 at 08:26 PM. |
| Thread Tools | |
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Are there no "and" "or" operators in mql4?? | kxracer500 | Metatrader 4 | 2 | 06-23-2007 08:14 AM |
| MT4 is there a "close all open trades script/command?" | keramikus | Metatrader 4 | 3 | 05-29-2007 01:49 PM |
| How to "teach" and to use the AI ("neuron") EA? | danil | Suggestions for Trading Systems | 4 | 03-18-2007 11:29 PM |
| Lot sum after EA test / Avoid "CLOSE AT STOP" | budhax | Expert Advisors - Metatrader 4 | 4 | 02-16-2007 03:16 AM |
| what's the meaning of "close at stop"? | phoenix | General Discussion | 2 | 06-24-2006 02:07 AM |