| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Simple script to snap lines to high or low of candles https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=2086 |
Page 2 of 2 |
| Author: | 123Reverse [ Sat Aug 24, 2013 1:39 am ] |
| Post subject: | Re: Simple script to snap lines to high or low of candles |
hannele, //+------------------------------------------------------------------+ //| HLOC Line.mq4 | //| DP | //| Draws High ,Low, Mid, Open and Close lines on selected candle. | //+------------------------------------------------------------------+ #property copyright "DP" #property link "With thanks to gaheitman on stevenhopwoodforex.com" //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //delete the old lines ObjectDelete("MyCloseLine"); ObjectDelete("MyLowLine"); ObjectDelete("MyOpenLine"); ObjectDelete("MyHighLine"); ObjectDelete("MyMidLine"); //set colours double opencolor = Tomato; double closecolor = Tomato; double highcolor = OrangeRed; double lowcolor = OrangeRed; double midcolor = Goldenrod; //get the Close, High, Open, Low prices of the dropped on bar double Cl = Close[iBarShift(Symbol(),0,WindowTimeOnDropped())]; double Hi = High[iBarShift(Symbol(),0,WindowTimeOnDropped())]; double Op = Open[iBarShift(Symbol(),0,WindowTimeOnDropped())]; double Lo = Low[iBarShift(Symbol(),0,WindowTimeOnDropped())]; double Mi = (Cl+Op)/2; //create the lines ObjectCreate("MyCloseLine", OBJ_HLINE, 0,WindowTimeOnDropped(),Cl); ObjectSet("MyCloseLine", OBJPROP_COLOR, closecolor); ObjectCreate("MyHighLine", OBJ_HLINE, 0,WindowTimeOnDropped(),Hi); ObjectSet("MyHighLine", OBJPROP_COLOR, highcolor); ObjectCreate("MyOpenLine", OBJ_HLINE, 0,WindowTimeOnDropped(),Op); ObjectSet("MyOpenLine", OBJPROP_COLOR, opencolor); ObjectCreate("MyLowLine", OBJ_HLINE, 0,WindowTimeOnDropped(),Lo); ObjectSet("MyLowLine", OBJPROP_COLOR, lowcolor); ObjectCreate("MyMidLine", OBJ_HLINE, 0,WindowTimeOnDropped(),Mi); ObjectSet("MyMidLine", OBJPROP_COLOR, midcolor); return(0); } //+------------------------------------------------------------------+ HTH Cheers |
|
| Author: | hannele [ Sat Aug 24, 2013 10:47 pm ] |
| Post subject: | Re: Simple script to snap lines to high or low of candles |
Thank you cheers hannele |
|
| Author: | ecodesign [ Thu May 29, 2014 7:33 pm ] |
| Post subject: | Simple script to snap lines to high or low of candles |
A belated addition to this discussion: For those still interested... a script that snaps a line to a high or a low of any candle, for as many candles as you want. Colour of the line is different on a high or a low. A text value of the high/low is shown above/below the candle. The script is called PSR (previous support-resistance) Just drag the script near to the high and/or low and release. Drag the PSR_Remove file to remove all lines and texts. Hope this helps. Wayne |
|
| All times are UTC | Page 2 of 2 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|