//+------------------------------------------------------------------+ //| Instantaneous Trend Line by John Ehlers | //| Copyright © 2004, Poul_Trade_Forum | //| Aborigen | //| http://forex.kbpauk.ru/ | //+------------------------------------------------------------------+ #property copyright "JDP" #property link "" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue extern double BuyLevel = -0.0003; extern double SellLevel = 0.0003; extern bool alert=true; //---- buffers int LastTm; int PVolume; double PPrice; double VUp[]; double VDn[]; double Price[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; IndicatorBuffers(2); //---- indicator line SetIndexStyle(0,DRAW_LINE,EMPTY,2,Red); SetIndexStyle(1,DRAW_LINE,EMPTY,2,Blue); SetIndexBuffer(0,VDn); SetIndexBuffer(1,VUp); SetIndexEmptyValue(0,0); SetIndexEmptyValue(1,0); //---- name for DataWindow and indicator subwindow label short_name="#Tick-Volume"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //---- SetIndexDrawBegin(0,30); SetIndexDrawBegin(1,30); //---- return(0); } int deinit(){return(0);} int start() { double Price,VDelta,PDelta,Delta; int i,shift,count; string oname; if (LastTm < Time[0]) { for (i = 0;i<1000;i++) { VUp[i] = VUp[i+1]; VDn[i] = VDn[i+1]; } PVolume = 0; if (LastTm==0) {PVolume = iVolume(Symbol(),0,0);} if (LastTm==0) {PPrice = (Ask+Bid)/2;} LastTm = Time[0]; } for (i = 1001;i>0;i--) { VUp[i] = VUp[i-1]; VDn[i] = VDn[i-1]; } Price = (Ask+Bid)/2; VDelta = (iVolume(Symbol(),0,0)-PVolume); PDelta = Price - PPrice; Delta = VDelta * PDelta; VUp[0] = VUp[1] + Delta; PPrice = Price; PVolume = PVolume + VDelta; GlobalVariableSet("TV",0); if (VUp[0] - VUp[1] < BuyLevel) { //Up oname ="V-" + TimeLocal(); ObjectCreate(oname,22,0,Time[0],Bid); ObjectSet(oname,OBJPROP_COLOR,Blue); ObjectSet(oname,OBJPROP_ARROWCODE,241); if (alert==true) { Alert("Buy "+oname); } } if (VUp[0] - VUp[1] > SellLevel) { //Dn oname ="V-" + TimeLocal(); ObjectCreate(oname,22,0,Time[0],Ask); ObjectSet(oname,OBJPROP_COLOR,Red); ObjectSet(oname,OBJPROP_ARROWCODE,242); if (alert==true) { Alert("Sell "+oname); } } bool Found = false; for (i=10;i>=0;i--) { if (VUp[i] - VUp[i+1] < BuyLevel) { GlobalVariableSet("TV",1); Found = true; } if (VUp[i] - VUp[i+1] > SellLevel) { GlobalVariableSet("TV",-1); Found = true; } } if (Found==false) { GlobalVariableSet("TV",0); } return(0); }
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Series array that contains tick volumes of each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features:
It issuies visual alerts to the screen