// More information about this indicator can be found at: //http://fxcodebase.com/code/viewtopic.php?f=38&t=65495 // LUA Original can be found at: // http://fxcodebase.com/code/viewtopic.php?f=17&t=2427 //+------------------------------------------------------------------+ //| Copyright © 2017, Gehtsoft USA LLC | //| http://fxcodebase.com | //+------------------------------------------------------------------+ //| Developed by : Mario Jemic | //| mario.jemic@gmail.com | //+------------------------------------------------------------------+ //| Support our efforts by donating | //| Paypal: https://goo.gl/9Rj74e | //+------------------------------------------------------------------+ //| BitCoin : 15VCJTLaz12Amr7adHSBtL9v8XomURo9RF | //| BitCoin Cash: 1BEtS465S3Su438Kc58h2sqvVvHK9Mijtg | //| Ethereum : 0x8C110cD61538fb6d7A2B47858F0c0AaBd663068D | //| LiteCoin : LLU8PSY2vsq7B9kRELLZQcKf5nJQrdeqwD | //+------------------------------------------------------------------+ #property copyright "Copyright © 2017, Gehtsoft USA LLC" #property link "http://fxcodebase.com" #property indicator_separate_window #property indicator_buffers 9 extern int Wick_Width = 1; extern int Candle_Width = 6; extern color Bullish_Wick_Color = clrAqua; extern color Bullish_Candle_Color = clrDodgerBlue; extern color Bearish_Wick_Color = clrLightPink; extern color Bearish_Candle_Color = clrCrimson; extern color Price_Color = clrDarkGray; double Bullish_Wick_High[]; double Bullish_Wick_Low[]; double Bullish_Candle_High[]; double Bullish_Candle_Low[]; double Bearish_Wick_High[]; double Bearish_Wick_Low[]; double Bearish_Candle_High[]; double Bearish_Candle_Low[]; double Empty[]; string WindowName; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators WindowName = "Linear_Price_Bar ("+Symbol()+")"; IndicatorShortName(WindowName); IndicatorBuffers(9); color BGColor = BackgroundColor(); SetIndexBuffer(0,Bullish_Wick_High); SetIndexBuffer(1,Bullish_Candle_High); SetIndexBuffer(2,Bullish_Candle_Low); SetIndexBuffer(3,Bullish_Wick_Low); SetIndexBuffer(4,Bearish_Wick_High); SetIndexBuffer(7,Bearish_Candle_High); SetIndexBuffer(6,Bearish_Candle_Low); SetIndexBuffer(5,Bearish_Wick_Low); SetIndexBuffer(8,Empty); SetIndexStyle(0,DRAW_HISTOGRAM,0,Wick_Width,Bullish_Wick_Color); SetIndexStyle(1,DRAW_HISTOGRAM,0,Candle_Width,Bullish_Candle_Color); SetIndexStyle(2,DRAW_HISTOGRAM,0,Candle_Width,BGColor); SetIndexStyle(3,DRAW_HISTOGRAM,0,Wick_Width,Bullish_Wick_Color); SetIndexStyle(4,DRAW_HISTOGRAM,0,Wick_Width,Bearish_Wick_Color); SetIndexStyle(7,DRAW_HISTOGRAM,0,Candle_Width,Bearish_Candle_Color); SetIndexStyle(6,DRAW_HISTOGRAM,0,Candle_Width,BGColor); SetIndexStyle(5,DRAW_HISTOGRAM,0,Wick_Width,Bearish_Wick_Color); SetIndexStyle(8,DRAW_HISTOGRAM,0,Candle_Width,BGColor); SetIndexLabel(0,"Bullish High"); SetIndexLabel(1,"Bullish Close"); SetIndexLabel(2,"Bullish Open"); SetIndexLabel(4,"Bearish High"); SetIndexLabel(5,"Bearish Open"); SetIndexLabel(6,"Bearish Close"); SetIndexLabel(8,"Candle Low"); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { for(int i = MathMax(Bars-1-IndicatorCounted(),1); i>=0; i--){ // Bulish Candle if (Open[i]<=Close[i]){ Bullish_Wick_High[i] = High[i] - Open[i]; Bullish_Candle_High[i] = Close[i] - Open[i]; Bullish_Candle_Low[i] = Low[i] - Open[i]; Bullish_Wick_Low[i] = Low[i] - Open[i]; // Down Empty Empty[i] = 0; } // Bearish Candle else{ Bearish_Wick_High[i] = High[i] - Open[i]; Bearish_Candle_High[i] = Close[i] - Open[i]; Bearish_Candle_Low[i] = 0; Bearish_Wick_Low[i] = Low[i] - Open[i]; // Down Empty Empty[i] = 0; } } Price((Close[0]),Price_Color); return(0); } //+------------------------------------------------------------------+ color BackgroundColor(){ long bgcolor=clrNONE; ResetLastError(); if(!ChartGetInteger(0,CHART_COLOR_BACKGROUND,0,bgcolor)){ Print(__FUNCTION__+", Error_Code = ",GetLastError()); } return((color)bgcolor); } void Price(double precio, color P_Color){ ObjectDelete("Price"); ObjectCreate("Price", OBJ_HLINE, WindowFind(WindowName),0,precio); ObjectSet("Price", OBJPROP_COLOR, P_Color); ObjectSet("Price", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("Price", OBJPROP_WIDTH, 0); ObjectSet("Price", OBJPROP_BACK, False); }