//+------------------------------------------------------------------+ //| EntropyMath.mq4 | //| Aleksandr Pak | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, MetaQuotes Software Corp." #property link "http://forum.mql4.com/ru/13708" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red #property indicator_level1 0.0001 #property indicator_level2 -0.0001 double entropy[],SignalBuffer[]; extern int numbars=14; extern int SignalSMA=5; //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,entropy); SetIndexStyle(0,DRAW_HISTOGRAM); IndicatorShortName("Entropy("+numbars+")"); IndicatorDigits(3*Digits); SetIndexBuffer(1,SignalBuffer); SetIndexStyle(1,DRAW_LINE); IndicatorDigits(3*Digits); return(0); } //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ int start () { double P, G; int in, out; int i,j; double sumx = 0.0; double sumx2 = 0.0; double avgx = 0.0; double rmsx = 0.0; in=0; //price; out=0; //entropy; int count = IndicatorCounted(); for (i=0; iBars-numbars+1) entropy[out] = EMPTY_VALUE; else { sumx = 0; sumx2=0 ; avgx =0; rmsx = 0.0; for (j=0;j