COT Net position Standard deviation indicator New comment Irfan 2014.10.01 07:26 Hi, can someone help me with this indicator i've got from here. I've modifying it so the indicator would draw standard deviation of the net position from COT data, but when I'm loading it onto the chart, it draw nothing... This is the source code://+------------------------------------------------------------------+ //| Meta COT Net Positions.mq4 | //| Copyright © 2009, C-4 (Vasiliy Sokolov, Russia, St.-Petersburg,| //| 2009), All Rights Reserved. | //| vs-box@mail.ru | //+------------------------------------------------------------------+ // Ïîêàçûâàåò ÷èñòûå ïîçèöèè òðåéäåðîâ. //see also: "Meta COT Project - New Horizons for CFTC Report Analysis in MetaTrader 4", https://www.mql5.com/en/articles/1573 #property copyright "Copyright © 2009, C-4 (Vasiliy Sokolov (vs-box@mail.ru), SPb), All Rights Reserved. // mod. fxdaytrader" #property link "http://ForexBaron.net" #property indicator_separate_window #property indicator_buffers 12 #property indicator_color1 Green #property indicator_color2 Blue #property indicator_color3 Red #property indicator_color4 Silver #property indicator_color5 Green #property indicator_color6 Blue #property indicator_color7 Red #property indicator_color8 Silver #property indicator_color9 Green #property indicator_color10 Blue #property indicator_color11 Red #property indicator_color12 Silver #property indicator_level1 0 int period=52; int movement_index=6; extern int ma_period = 52; input int sd_period = 1; extern color ColorOpenInterest = Green; extern color ColorNonComm = Blue; extern color ColorOperators = Red; extern color ColorNonRep = Silver; extern bool Show_nNoncomm=true;//false; extern bool Show_nOperators=false;//false; extern bool Show_nNonrep=false;//false; extern bool Show_nOI=false; bool printerror=false;//fxdaytrader double i_open_interest[]; double i_noncomm[]; double i_operators[]; double i_nonrep[]; double sd_oi[], sd_nc[], sd_cm[], sd_nr[], ma_oi[], sd_up_oi[], sd_lo_oi[], ma_nc[], sd_up_nc[], sd_lo_nc[], ma_cm[], sd_up_cm[], sd_lo_cm[], ma_nr[], sd_up_nr[], sd_lo_nr[], cavg_oi[], cavg_nc[], cavg_cm[], cavg_nr[],mid_oi[], mid_nc[], mid_cm[], mid_nr[]; #include <cotlib.mq4> int init() { if(init_data()==false)error=true; if(error==false)load_data(); if(error==false)count_data(); SetParam(); return 0; } int start() { if (error) if (!printerror) { printerror=true; Print("ERROR="+GetLastError()); } if (!error) printerror=false; DrowData(); return 0; } void SetParam() { SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,ColorOpenInterest); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,ColorOpenInterest); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1,ColorOpenInterest); SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1,ColorNonComm); SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,1,ColorNonComm); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID,1,ColorNonComm); SetIndexStyle(6,DRAW_LINE,STYLE_SOLID,1,ColorOperators); SetIndexStyle(7,DRAW_LINE,STYLE_SOLID,1,ColorOperators); SetIndexStyle(8,DRAW_LINE,STYLE_SOLID,1,ColorOperators); SetIndexStyle(9,DRAW_LINE,STYLE_SOLID,1,ColorNonRep); SetIndexStyle(10,DRAW_LINE,STYLE_SOLID,1,ColorNonRep); SetIndexStyle(11,DRAW_LINE,STYLE_SOLID,1,ColorNonRep); IndicatorDigits(0); SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); SetIndexEmptyValue(2,0.0); SetIndexEmptyValue(3,0.0); SetIndexEmptyValue(4,0.0); SetIndexEmptyValue(5,0.0); SetIndexEmptyValue(6,0.0); SetIndexEmptyValue(7,0.0); SetIndexEmptyValue(8,0.0); SetIndexEmptyValue(9,0.0); SetIndexEmptyValue(10,0.0); SetIndexEmptyValue(11,0.0); if(load_cot_file==true)IndicatorShortName(StringConcatenate("Meta COT Net Pos SD.: ", str_trim(cot_file))); else IndicatorShortName(StringConcatenate("Meta COT Net Pos SD.: ", name)); if(Show_nOI==true){ SetIndexBuffer(0,sd_up_oi); SetIndexLabel(0, "Open Interest + "+sd_period+" SD"); SetIndexBuffer(1,mid_oi); SetIndexLabel(1, "Open Interest Average"); SetIndexBuffer(2,sd_lo_oi); SetIndexLabel(2, "Open Interest - "+sd_period+" SD"); } if(Show_nNoncomm==true){ SetIndexBuffer(3,sd_up_nc); SetIndexLabel(3, "Net Non Commercial + "+sd_period+" SD"); SetIndexBuffer(4,mid_nc); SetIndexLabel(4, "Net Non Commercial Average"); SetIndexBuffer(5,sd_lo_oi); SetIndexLabel(5, "Net Non Commercial - "+sd_period+" SD"); } if(Show_nOperators==true){ SetIndexBuffer(6,sd_up_cm); SetIndexLabel(6, "Net Commercial + "+sd_period+" SD"); SetIndexBuffer(7,mid_cm); SetIndexLabel(7, "Net Commercial Average"); SetIndexBuffer(8,sd_lo_cm); SetIndexLabel(8, "Net Commercial - "+sd_period+" SD"); } if(Show_nNonrep==true){ SetIndexBuffer(9,sd_up_nr); SetIndexLabel(9, "Net Non Reportable + "+sd_period+" SD"); SetIndexBuffer(10,mid_nr); SetIndexLabel(10, "Net Non Reportable Average"); SetIndexBuffer(11,sd_lo_nr); SetIndexLabel(11, "Net Non Reportable - "+sd_period+" SD"); } } void DrowData() { int end_data=get_lastdata(); for(int i=0;i<end_data;i++){ i_open_interest[i]=get_data(OI, i); i_noncomm[i]=get_data(NET_NONCOMM, i); i_operators[i]=get_data(NET_OPERATORS, i); i_nonrep[i]=get_data(NET_NONREP,i); ma_oi[i] = iMAOnArray(i_open_interest,0,ma_period,0,MODE_SMA,i); ma_nc[i] = iMAOnArray(i_noncomm,0,ma_period,0,MODE_SMA,i); ma_cm[i] = iMAOnArray(i_operators,0,ma_period,0,MODE_SMA,i); ma_nr[i] = iMAOnArray(i_nonrep,0,ma_period,0,MODE_SMA,i); mid_oi[i] = ma_oi[i]; sd_oi[i] = iStdDevOnArray(i_open_interest,0,ma_period,0,MODE_SMA,i); sd_lo_oi[i] = mid_oi[i]-(sd_period*sd_oi[i]); sd_up_oi[i] = mid_oi[i]+(sd_period*sd_oi[i]); mid_nc[i] = ma_nc[i]; sd_nc[i] = iStdDevOnArray(i_noncomm,0,ma_period,0,MODE_SMA,i); sd_lo_nc[i] = mid_nc[i]-(sd_period*sd_nc[i]); sd_up_nc[i] = mid_nc[i]+(sd_period*sd_nc[i]); mid_cm[i] = ma_cm[i]; sd_cm [i]= iStdDevOnArray(i_operators,0,ma_period,0,MODE_SMA,i); sd_lo_cm[i] = mid_cm[i]-(sd_period*sd_cm[i]); sd_up_cm[i] = mid_cm[i]+(sd_period*sd_cm[i]); mid_nr[i] = ma_nr[i]; sd_nr[i] = iStdDevOnArray(i_nonrep,0,ma_period,0,MODE_SMA,i); sd_lo_nr[i] = mid_nr[i]-(sd_period*sd_nr[i]); sd_up_nr[i] = mid_nr[i]+(sd_period*sd_nr[i]); } }Thanks in advance COT Standard deviation indicator Standard Deviation Channel Moving Average and Standard Deviation New comment
Hi,
can someone help me with this indicator i've got from here. I've modifying it so the indicator would draw standard deviation of the net position from COT data, but when I'm loading it onto the chart, it draw nothing... This is the source code:
Thanks in advance