/*[[ Name := iTrend 1.01 Author := Andrew Link := http://anri.aney.ru/forex/ Notes := TREND INDICATOR Separate Window := YES First Color := blue First Draw Type := histogram First Symbol := 217 Use Second Data := Yes Second Color := red Second Draw Type := histogram Second Symbol := 218 ]]*/ inputs: iBands_Mode_0_2(0); // =0-2 MODE_MAIN, MODE_LOW, MODE_HIGH inputs: iPower_Price_0_6(0); // =0-6 PRICE_CLOSE,PRICE_OPEN,PRICE_HIGH,PRICE_LOW,PRICE_MEDIAN,PRICE_TYPICAL,PRICE_WEIGHTED inputs: iPrice_Type_0_3(0); // =0-3 PRICE_CLOSE,PRICE_OPEN,PRICE_HIGH,PRICE_LOW inputs: iBands_Period(20);//20 inputs: iBands_Deviation(2); inputs: iPower_Period(14);//13 Vars: value(0),value2(0),CurrentBar(0),Bands_Mode(0),Power_Price(0),CurrentPrice(0); SetLoopCount(0); if iBands_Mode_0_2=1 then Bands_Mode=MODE_LOW else if iBands_Mode_0_2=2 then Bands_Mode=MODE_HIGH else Bands_Mode=MODE_MAIN; if iPower_Price_0_6=1 then Power_Price=PRICE_OPEN else if iPower_Price_0_6=2 then Power_Price=PRICE_HIGH else if iPower_Price_0_6=3 then Power_Price=PRICE_LOW else if iPower_Price_0_6=4 then Power_Price=PRICE_MEDIAN else if iPower_Price_0_6=5 then Power_Price=PRICE_TYPICAL else if iPower_Price_0_6=6 then Power_Price=PRICE_WEIGHTED else Power_Price=PRICE_CLOSE; For CurrentBar=200 DownTo 0 begin if iPrice_Type_0_3=1 then CurrentPrice=open[CurrentBar] else if iPrice_Type_0_3=2 then CurrentPrice=high[CurrentBar] else if iPrice_Type_0_3=3 then CurrentPrice=low[CurrentBar] else CurrentPrice=close[CurrentBar]; value=CurrentPrice-iBands(iBands_Period,iBands_Deviation,Bands_Mode,CurrentBar); if value < 0 then value = 0; if value > 0 then value = 1; setIndexValue(CurrentBar, value); value2=-(iBearsPower(iPower_Period,Power_Price,CurrentBar)+iBullsPower(iPower_Period,Power_Price,CurrentBar)); if value2 < 0 then value2 = 0; if value2 > 0 then value2 = -1; setIndexValue2(CurrentBar, value2); if value = 1 then SetGlobalVariable("MEDV",value); if value2 = -1 then SetGlobalVariable("MEDV",value); if value2 = -1 and value = 1 then SetGlobalVariable("MEDV",0); //SetGlobalVariable("BUK",value); end;