Metatrader Expert Advisor

Indicatore MetaTrader //+------------------------------------------------------------------+ //| (T_S_R)-Daily Range Calculator v1.3.mq4 | //| Copyright © 2006, Ogeima | //| Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloakd048f68c7660cbf88ab7438668180072').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addyd048f68c7660cbf88ab7438668180072 = 'ph_bresson' + '@'; addyd048f68c7660cbf88ab7438668180072 = addyd048f68c7660cbf88ab7438668180072 + 'yahoo' + '.' + 'com'; var addy_textd048f68c7660cbf88ab7438668180072 = 'ph_bresson' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloakd048f68c7660cbf88ab7438668180072').innerHTML += ''+addy_textd048f68c7660cbf88ab7438668180072+''; //|Made for the TSR (Trend Slope Retracement) system by FXiGoR | //|http://strategybuilderfx.com/showthread.php?t=17252 | //+------------------------------------------------------------------+ // For basic explanations, see the notes at the end this script. // For information regarding the T_S_R method, read the "FXiGoR-(T_S_R) very effective Trend Slope Retracement system" thread opened by iGoR at StrategyBuilderfx, Forex-tsd, MoneyTec, ForexFactory or Trade2Win. #property copyright "Copyright © 2006, Ogeima" #property link "Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloakb5039dad1905992a4aea633cec5fcebd').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addyb5039dad1905992a4aea633cec5fcebd = 'ph_bresson' + '@'; addyb5039dad1905992a4aea633cec5fcebd = addyb5039dad1905992a4aea633cec5fcebd + 'yahoo' + '.' + 'com'; var addy_textb5039dad1905992a4aea633cec5fcebd = 'ph_bresson' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloakb5039dad1905992a4aea633cec5fcebd').innerHTML += ''+addy_textb5039dad1905992a4aea633cec5fcebd+''; " #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Green #property indicator_color2 Red //---- input parameters extern double Risk_to_Reward_ratio = 3.0; double aSL_Long[]; double aSL_Short[]; int nDigits; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(2); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,3); SetIndexBuffer(0,aSL_Long); SetIndexBuffer(1,aSL_Short); SetIndexEmptyValue(0,EMPTY_VALUE); SetIndexEmptyValue(1,EMPTY_VALUE); if(Symbol()=="GBPJPY" || Symbol()=="EURJPY" || Symbol()=="USDJPY" || Symbol()=="CHFJPY" || Symbol()=="GOLD" || Symbol()=="_SP500") nDigits = 2; else nDigits = 4; return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { Comment(""); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int R1=0,R5=0,R10=0,R20=0,RAvg=0; int RoomUp=0,RoomDown=0,StopLoss_Long=0,StopLoss_Short=0; double SL_Long=0,SL_Short=0; double low0=0,high0=0; string Text=""; int i=0; R1 = (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Point; for(i=1;i<=5;i++) R5 = R5 + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point; for(i=1;i<=10;i++) R10 = R10 + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point; for(i=1;i<=20;i++) R20 = R20 + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point; R5 = R5/5; R10 = R10/10; R20 = R20/20; RAvg = (R5+R10+R20)/3; low0 = iLow(NULL,PERIOD_D1,0); high0 = iHigh(NULL,PERIOD_D1,0); RoomUp = RAvg - (Bid - low0)/Point; RoomDown = RAvg - (high0 - Bid)/Point; StopLoss_Long = RoomUp/Risk_to_Reward_ratio; SL_Long = Bid - StopLoss_Long*Point; StopLoss_Short = RoomDown/Risk_to_Reward_ratio; SL_Short = Bid + StopLoss_Short*Point; Text = "Average Day Range: " + RAvg + "\n" + "Prev 01 Day Range: " + R1 + "\n" + "Prev 05 Days Range: " + R5 + "\n" + "Prev 10 Days Range: " + R10 + "\n" + "Prev 20 Days Range: " + R20 + "\n"; Text = Text + "Room Up: " + RoomUp + "\n" + "Room Down: " + RoomDown + "\n" + "Max. StopLosses should be :" + "\n" + "Long: " + StopLoss_Long + " Pips at " + DoubleToStr(SL_Long,nDigits) + "\n" + "Short: " + StopLoss_Short + " Pips at " + DoubleToStr(SL_Short,nDigits) + "\n"; Comment(Text); //-- SL Lines int limit; int counted_bars=IndicatorCounted(); if(counted_bars<0) counted_bars=0; if(counted_bars>0) counted_bars--; limit = counted_bars; for(i = 0 ;i <= limit ;i++) { if(i==0 || i==1 || i==2) { aSL_Long[i] = SL_Long; aSL_Short[i]= SL_Short; } else { aSL_Long[i] = EMPTY_VALUE; aSL_Short[i]= EMPTY_VALUE; } } return(0); } //+------------------------------------------------------------------+ /* Here's a little "indicator" that does some basic calculations for us. Let's look at what it does: It computes yesterday's range, the previous 5, 10 and 20 days ranges. And it calculates the "Average Day Range" of these four ranges (yesterday's+ Prev 5 Day Range + Prev 10 Day Range + Prev 20 Day Range)/4. So, if yesterday's Day Range was 80, the Previous 5 Day Range was 110, the Previous 10 Day Range was 90 and the Previous 20 Day Range was 120, then the Average Day Range would be 100. Then there's "Room Up" and "Room Down". Let's imagine today's low is (so far) 1000 and today's high is (so far) 1050. At this moment the price is 1020. So we're 1020-1000= 20 pips above the low, there is therefore 100-20=80 pips "left" up. For a risk-to-reward ratio of (say) 3, if a long trade was to be entered now, the stop loss should be no more than 80/3=26pips away, that is at 1020-26=994. So, if all conditions are met, we ll look for a "bottom" no lower than 994. Same thing for a short trade: we are 1050-1020= 30 pips below the high, there is therefore 100-30=70 pips "left" down. For a risk-to-reward ratio of 3, if a short trade was to be entered now, the stop loss should be no more than 70/3=23pips away, that is at 1020+23=1043. So, if all conditions are met, we ll look for a "top" no higher than 1043. As you can see, this indicator doesn't tell us whether or not we have a set up to trade. What it does is, considering some past day ranges, and for a given Risk to Reward ratio, it tells us how far away we can put a stop loss. Hope this helps, Ogeima. P.S.: I used H-L (High-Low) to compute the Ranges. They are thus a bit different from mataf.net data, which computes what is known as the "True" Ranges (= Max(High for the period less the Low for the period,High for the period less the Close for the previous period,Close for the previous period and the Low for the current period)). -------- PS1: occasionnally, as someone apparently pointed out in the chatroom, RoomUp/RoomDown (and the indicative stop losses) will have negative values. For example, let's imagine that the Average Day Range is 100, today's High is 1150, today's low is 1000 and the current price is 1040. Price has traveled 1150-1040 = 110 pips down from the High, that's 10 pips more than the 100 pips of the Average Day Range, so the RoomDown will be -10 pips (and the stoploss will be -10/Risk_to_Reward_ratio). (And price has traveled 1040-1000= 40 pips from the Low so the RoomUp will be positive (=100-40=60), nothing special here.) -------- v1.3: added 2 horizontal lines at the level of the StopLosses: Green line for Long SL, Red line for Short SL. */ //+------------------------------------------------------------------+ //| (T_S_R)-Daily Range Calculator v1.3.mq4 | //| Copyright © 2006, Ogeima | //| Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak348cf6451411b335a796935bc41fc48b').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy348cf6451411b335a796935bc41fc48b = 'ph_bresson' + '@'; addy348cf6451411b335a796935bc41fc48b = addy348cf6451411b335a796935bc41fc48b + 'yahoo' + '.' + 'com'; var addy_text348cf6451411b335a796935bc41fc48b = 'ph_bresson' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloak348cf6451411b335a796935bc41fc48b').innerHTML += ''+addy_text348cf6451411b335a796935bc41fc48b+''; //|Made for the TSR (Trend Slope Retracement) system by FXiGoR | //|http://strategybuilderfx.com/showthread.php?t=17252 | //+------------------------------------------------------------------+ // For basic explanations, see the notes at the end this script. // For information regarding the T_S_R method, read the "FXiGoR-(T_S_R) very effective Trend Slope Retracement system" thread opened by iGoR at StrategyBuilderfx, Forex-tsd, MoneyTec, ForexFactory or Trade2Win. #property copyright "Copyright © 2006, Ogeima" #property link "Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak5242ba1d5285cee67f18b6bcc07bf214').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy5242ba1d5285cee67f18b6bcc07bf214 = 'ph_bresson' + '@'; addy5242ba1d5285cee67f18b6bcc07bf214 = addy5242ba1d5285cee67f18b6bcc07bf214 + 'yahoo' + '.' + 'com'; var addy_text5242ba1d5285cee67f18b6bcc07bf214 = 'ph_bresson' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloak5242ba1d5285cee67f18b6bcc07bf214').innerHTML += ''+addy_text5242ba1d5285cee67f18b6bcc07bf214+''; " #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Green #property indicator_color2 Red //---- input parameters extern double Risk_to_Reward_ratio = 3.0; double aSL_Long[]; double aSL_Short[]; int nDigits; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(2); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,3); SetIndexBuffer(0,aSL_Long); SetIndexBuffer(1,aSL_Short); SetIndexEmptyValue(0,EMPTY_VALUE); SetIndexEmptyValue(1,EMPTY_VALUE); if(Symbol()=="GBPJPY" || Symbol()=="EURJPY" || Symbol()=="USDJPY" || Symbol()=="CHFJPY" || Symbol()=="GOLD" || Symbol()=="_SP500") nDigits = 2; else nDigits = 4; return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { Comment(""); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int R1=0,R5=0,R10=0,R20=0,RAvg=0; int RoomUp=0,RoomDown=0,StopLoss_Long=0,StopLoss_Short=0; double SL_Long=0,SL_Short=0; double low0=0,high0=0; string Text=""; int i=0; R1 = (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/Point; for(i=1;i<=5;i++) R5 = R5 + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point; for(i=1;i<=10;i++) R10 = R10 + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point; for(i=1;i<=20;i++) R20 = R20 + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point; R5 = R5/5; R10 = R10/10; R20 = R20/20; RAvg = (R5+R10+R20)/3; low0 = iLow(NULL,PERIOD_D1,0); high0 = iHigh(NULL,PERIOD_D1,0); RoomUp = RAvg - (Bid - low0)/Point; RoomDown = RAvg - (high0 - Bid)/Point; StopLoss_Long = RoomUp/Risk_to_Reward_ratio; SL_Long = Bid - StopLoss_Long*Point; StopLoss_Short = RoomDown/Risk_to_Reward_ratio; SL_Short = Bid + StopLoss_Short*Point; Text = "Average Day Range: " + RAvg + "\n" + "Prev 01 Day Range: " + R1 + "\n" + "Prev 05 Days Range: " + R5 + "\n" + "Prev 10 Days Range: " + R10 + "\n" + "Prev 20 Days Range: " + R20 + "\n"; Text = Text + "Room Up: " + RoomUp + "\n" + "Room Down: " + RoomDown + "\n" + "Max. StopLosses should be :" + "\n" + "Long: " + StopLoss_Long + " Pips at " + DoubleToStr(SL_Long,nDigits) + "\n" + "Short: " + StopLoss_Short + " Pips at " + DoubleToStr(SL_Short,nDigits) + "\n"; Comment(Text); //-- SL Lines int limit; int counted_bars=IndicatorCounted(); if(counted_bars<0) counted_bars=0; if(counted_bars>0) counted_bars--; limit = counted_bars; for(i = 0 ;i <= limit ;i++) { if(i==0 || i==1 || i==2) { aSL_Long[i] = SL_Long; aSL_Short[i]= SL_Short; } else { aSL_Long[i] = EMPTY_VALUE; aSL_Short[i]= EMPTY_VALUE; } } return(0); } //+------------------------------------------------------------------+ /* Here's a little "indicator" that does some basic calculations for us. Let's look at what it does: It computes yesterday's range, the previous 5, 10 and 20 days ranges. And it calculates the "Average Day Range" of these four ranges (yesterday's+ Prev 5 Day Range + Prev 10 Day Range + Prev 20 Day Range)/4. So, if yesterday's Day Range was 80, the Previous 5 Day Range was 110, the Previous 10 Day Range was 90 and the Previous 20 Day Range was 120, then the Average Day Range would be 100. Then there's "Room Up" and "Room Down". Let's imagine today's low is (so far) 1000 and today's high is (so far) 1050. At this moment the price is 1020. So we're 1020-1000= 20 pips above the low, there is therefore 100-20=80 pips "left" up. For a risk-to-reward ratio of (say) 3, if a long trade was to be entered now, the stop loss should be no more than 80/3=26pips away, that is at 1020-26=994. So, if all conditions are met, we ll look for a "bottom" no lower than 994. Same thing for a short trade: we are 1050-1020= 30 pips below the high, there is therefore 100-30=70 pips "left" down. For a risk-to-reward ratio of 3, if a short trade was to be entered now, the stop loss should be no more than 70/3=23pips away, that is at 1020+23=1043. So, if all conditions are met, we ll look for a "top" no higher than 1043. As you can see, this indicator doesn't tell us whether or not we have a set up to trade. What it does is, considering some past day ranges, and for a given Risk to Reward ratio, it tells us how far away we can put a stop loss. Hope this helps, Ogeima. P.S.: I used H-L (High-Low) to compute the Ranges. They are thus a bit different from mataf.net data, which computes what is known as the "True" Ranges (= Max(High for the period less the Low for the period,High for the period less the Close for the previous period,Close for the previous period and the Low for the current period)). -------- PS1: occasionnally, as someone apparently pointed out in the chatroom, RoomUp/RoomDown (and the indicative stop losses) will have negative values. For example, let's imagine that the Average Day Range is 100, today's High is 1150, today's low is 1000 and the current price is 1040. Price has traveled 1150-1040 = 110 pips down from the High, that's 10 pips more than the 100 pips of the Average Day Range, so the RoomDown will be -10 pips (and the stoploss will be -10/Risk_to_Reward_ratio). (And price has traveled 1040-1000= 40 pips from the Low so the RoomUp will be positive (=100-40=60), nothing special here.) -------- v1.3: added 2 horizontal lines at the level of the StopLosses: Green line for Long SL, Red line for Short SL. */
Indicatore MetaTrader //+------------------------------------------------------------------+ //| HMA.mq4 //| Copyright © 2006 WizardSerg <Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak719a48eacc8ba9ccfa11a6cb3c7b693b').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy719a48eacc8ba9ccfa11a6cb3c7b693b = 'wizardserg' + '@'; addy719a48eacc8ba9ccfa11a6cb3c7b693b = addy719a48eacc8ba9ccfa11a6cb3c7b693b + 'mail' + '.' + 'ru'; var addy_text719a48eacc8ba9ccfa11a6cb3c7b693b = 'wizardserg' + '@' + 'mail' + '.' + 'ru';document.getElementById('cloak719a48eacc8ba9ccfa11a6cb3c7b693b').innerHTML += ''+addy_text719a48eacc8ba9ccfa11a6cb3c7b693b+''; >, ?? ??????? ForexMagazine #104 //| Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloakb97c37d0093202163671c8571372ab63').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addyb97c37d0093202163671c8571372ab63 = 'wizardserg' + '@'; addyb97c37d0093202163671c8571372ab63 = addyb97c37d0093202163671c8571372ab63 + 'mail' + '.' + 'ru'; var addy_textb97c37d0093202163671c8571372ab63 = 'wizardserg' + '@' + 'mail' + '.' + 'ru';document.getElementById('cloakb97c37d0093202163671c8571372ab63').innerHTML += ''+addy_textb97c37d0093202163671c8571372ab63+''; //| Revised by IgorAD,Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloakf99280384bd2c71b1fbcf8413e0944bb').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addyf99280384bd2c71b1fbcf8413e0944bb = 'igorad2003' + '@'; addyf99280384bd2c71b1fbcf8413e0944bb = addyf99280384bd2c71b1fbcf8413e0944bb + 'yahoo' + '.' + 'co' + '.' + 'uk'; var addy_textf99280384bd2c71b1fbcf8413e0944bb = 'igorad2003' + '@' + 'yahoo' + '.' + 'co' + '.' + 'uk';document.getElementById('cloakf99280384bd2c71b1fbcf8413e0944bb').innerHTML += ''+addy_textf99280384bd2c71b1fbcf8413e0944bb+''; | //| Personalized by iGoR AKA FXiGoR for the Trend Slope Trading method (T_S_T) //| Link: //| contact: Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak48c5828c0782263792e8700b4424c759').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy48c5828c0782263792e8700b4424c759 = 'thefuturemaster' + '@'; addy48c5828c0782263792e8700b4424c759 = addy48c5828c0782263792e8700b4424c759 + 'hotmail' + '.' + 'com'; var addy_text48c5828c0782263792e8700b4424c759 = 'thefuturemaster' + '@' + 'hotmail' + '.' + 'com';document.getElementById('cloak48c5828c0782263792e8700b4424c759').innerHTML += ''+addy_text48c5828c0782263792e8700b4424c759+''; //+------------------------------------------------------------------+ #property copyright "MT4 release WizardSerg <Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak307e500950bd3effaef4912f8409fa21').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy307e500950bd3effaef4912f8409fa21 = 'wizardserg' + '@'; addy307e500950bd3effaef4912f8409fa21 = addy307e500950bd3effaef4912f8409fa21 + 'mail' + '.' + 'ru'; var addy_text307e500950bd3effaef4912f8409fa21 = 'wizardserg' + '@' + 'mail' + '.' + 'ru';document.getElementById('cloak307e500950bd3effaef4912f8409fa21').innerHTML += ''+addy_text307e500950bd3effaef4912f8409fa21+''; >, ?? ??????? ForexMagazine #104" #property link "Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak439f988c089651d4c830acfb3f2e5686').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy439f988c089651d4c830acfb3f2e5686 = 'wizardserg' + '@'; addy439f988c089651d4c830acfb3f2e5686 = addy439f988c089651d4c830acfb3f2e5686 + 'mail' + '.' + 'ru'; var addy_text439f988c089651d4c830acfb3f2e5686 = 'wizardserg' + '@' + 'mail' + '.' + 'ru';document.getElementById('cloak439f988c089651d4c830acfb3f2e5686').innerHTML += ''+addy_text439f988c089651d4c830acfb3f2e5686+''; " #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 LightBlue #property indicator_color2 Tomato //---- input parameters extern int period=80; extern int method=3; // MODE_SMA extern int price=0; // PRICE_CLOSE //---- buffers double Uptrend[]; double Dntrend[]; double ExtMapBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(3); SetIndexBuffer(0, Uptrend); //ArraySetAsSeries(Uptrend, true); SetIndexBuffer(1, Dntrend); //ArraySetAsSeries(Dntrend, true); SetIndexBuffer(2, ExtMapBuffer); ArraySetAsSeries(ExtMapBuffer, true); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); IndicatorShortName("Slope Direction Line("+period+")"); return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { // ???? ????? ?????? ?????? return(0); } //+------------------------------------------------------------------+ //| ?????????? ??????? | //+------------------------------------------------------------------+ double WMA(int x, int p) { return(iMA(NULL, 0, p, 0, method, price, x)); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); int x = 0; int p = MathSqrt(period); int e = Bars - counted_bars + period + 1; double vect[], trend[]; if(e > Bars) e = Bars; ArrayResize(vect, e); ArraySetAsSeries(vect, true); ArrayResize(trend, e); ArraySetAsSeries(trend, true); for(x = 0; x < e; x++) { vect[x] = 2*WMA(x, period/2) - WMA(x, period); // Print("Bar date/time: ", TimeToStr(Time[x]), " close: ", Close[x], " vect[", x, "] = ", vect[x], " 2*WMA(p/2) = ", 2*WMA(x, period/2), " WMA(p) = ", WMA(x, period)); } for(x = 0; x < e-period; x++) ExtMapBuffer[x] = iMAOnArray(vect, 0, p, 0, method, x); for(x = e-period; x >= 0; x--) { trend[x] = trend[x+1]; if (ExtMapBuffer[x]> ExtMapBuffer[x+1]) trend[x] =1; if (ExtMapBuffer[x]< ExtMapBuffer[x+1]) trend[x] =-1; if (trend[x]>0) { Uptrend[x] = ExtMapBuffer[x]; if (trend[x+1]<0) Uptrend[x+1]=ExtMapBuffer[x+1]; Dntrend[x] = EMPTY_VALUE; } else if (trend[x]<0) { Dntrend[x] = ExtMapBuffer[x]; if (trend[x+1]>0) Dntrend[x+1]=ExtMapBuffer[x+1]; Uptrend[x] = EMPTY_VALUE; } //Print( " trend=",trend[x]); } return(0); } //+------------------------------------------------------------------+
Indicatore MetaTrader //+------------------------------------------------------------------+ //| Heiken Ashi.mq4 | //| Copyright c 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net //| Personalized by iGoR for the Trend Slope Trading method (T_S_T) //| Link: http://www.strategybuilderfx.com/forums/showthread.php?t=16507 //| contact: Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak98e15323c13bf7cefca4b38d41581c50').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy98e15323c13bf7cefca4b38d41581c50 = 'igor' + '@'; addy98e15323c13bf7cefca4b38d41581c50 = addy98e15323c13bf7cefca4b38d41581c50 + 'igor' + '.' + 'cc'; var addy_text98e15323c13bf7cefca4b38d41581c50 = 'igor' + '@' + 'igor' + '.' + 'cc';document.getElementById('cloak98e15323c13bf7cefca4b38d41581c50').innerHTML += ''+addy_text98e15323c13bf7cefca4b38d41581c50+''; //+------------------------------------------------------------------+ //| For Heiken Ashi we recommend next chart settings ( press F8 or | //| select on menu 'Charts'->'Properties...'): | //| - On 'Color' Tab select 'Black' for 'Line Graph' | //| - On 'Common' Tab disable 'Chart on Foreground' checkbox and | //| select 'Line Chart' radiobutton | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 DimGray #property indicator_color2 DarkGray #property indicator_color3 DimGray #property indicator_color4 DarkGray //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; //---- int ExtCountedBars=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //|------------------------------------------------------------------| int init() { //---- indicators SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, Purple); SetIndexBuffer(0, ExtMapBuffer1); SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, DarkGreen); SetIndexBuffer(1, ExtMapBuffer2); SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, Purple); SetIndexBuffer(2, ExtMapBuffer3); SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3, DarkGreen); SetIndexBuffer(3, ExtMapBuffer4); //---- SetIndexDrawBegin(0,10); SetIndexDrawBegin(1,10); SetIndexDrawBegin(2,10); SetIndexDrawBegin(3,10); //---- indicator buffers mapping SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); SetIndexBuffer(2,ExtMapBuffer3); SetIndexBuffer(3,ExtMapBuffer4); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double haOpen, haHigh, haLow, haClose; if(Bars<=10) return(0); ExtCountedBars=IndicatorCounted(); //---- check for possible errors if (ExtCountedBars<0) return(-1); //---- last counted bar will be recounted if (ExtCountedBars>0) ExtCountedBars--; int pos=Bars-ExtCountedBars-1; while(pos>=0) { haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2; haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4; haHigh=MathMax(High[pos], MathMax(haOpen, haClose)); haLow=MathMin(Low[pos], MathMin(haOpen, haClose)); if (haOpen<haClose) { ExtMapBuffer1[pos]=haLow; ExtMapBuffer2[pos]=haHigh; } else { ExtMapBuffer1[pos]=haHigh; ExtMapBuffer2[pos]=haLow; } ExtMapBuffer3[pos]=haOpen; ExtMapBuffer4[pos]=haClose; pos--; } //---- return(0); } //+------------------------------------------------------------------+
Indicatore MetaTrader //------------------------------------------------------------------/ // Indicator-advisor based on Demark threory with additions // Some part of the code was taken from Ind-TD-DeMark-3-1.mq4 [Kara ©] //------------------------------------------------------------------/ #property copyright "GreenDog" #property link "Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak3388e2f481bca80cb82b014a8e66f771').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy3388e2f481bca80cb82b014a8e66f771 = 'krot' + '@'; addy3388e2f481bca80cb82b014a8e66f771 = addy3388e2f481bca80cb82b014a8e66f771 + 'inbox' + '.' + 'ru'; var addy_text3388e2f481bca80cb82b014a8e66f771 = 'krot' + '@' + 'inbox' + '.' + 'ru';document.getElementById('cloak3388e2f481bca80cb82b014a8e66f771').innerHTML += ''+addy_text3388e2f481bca80cb82b014a8e66f771+''; " // v2.3 #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue extern int showBars=3000; // if showBars= 0 so the indicator will be shown for all the chart extern int LevDP=2; // Demar Pint Levels; 2 = central bar will be higher (lower) then 2 bars on the left side and 2 bars on the right one. extern int qSteps=1; // number of steps/ no more than 3 extern int BackStep=0; // number of staps back extern int startBar=0; // ifstartBar=0 so we have recommendation for the current bar, if 1 - for possible next bar extern bool TrendLine=false; // false = no trend lines extern bool HorizontLine=false; // true = break levels extern bool ChannelLine=false; // true = channels which is parallel with trend lines extern bool TakeLines=false; // true = take profit lines extern bool Comments=false; // true = comments extern int Trend=0; // 1 = for UpTrendLines only, -1 = for DownTrendLines only, 0 = for all TrendLines extern bool ShowArrows=true; extern bool CustomFeatures=true; extern color UpTrendColor=Green; extern color DownTrendColor=Red; extern int TrendlineWidth=3; extern bool ShowAlerts=false; extern bool EmailAlert=false; int trendwidth; color trendcol; //int ColNum[]; double Buf1[]; double Buf2[]; int DotPip=10; //---- buffers double BuyBuffer[]; double SellBuffer[]; string Col[]={"Red","DarkBlue","Coral","DodgerBlue","SaddleBrown","MediumSeaGreen"}; //int ColNum[1]=coll1; //={coll1,coll2,coll3,coll4,coll5,coll6}; int ColNum[]={Red,DeepSkyBlue,Coral,Aqua,SaddleBrown,MediumSeaGreen}; //DeepSkyBlue int qPoint=0; // ïåðåìåííàÿ äëÿ íîðìàëèçàöèè öåíû int qBars; double qTime=0; // ïåðåìåííûå äëÿ ëèêâèäàöèè ãëþêîâ ïðè çàãðóçêå int init() { IndicatorBuffers(4); qBars=Bars; qSteps=MathMin(3,qSteps); while (NormalizeDouble(Point,qPoint)==0)qPoint++; int code=161; string Rem="DLines © GameOver"; IndicatorShortName(Rem); if (ShowArrows){ SetIndexStyle(0,DRAW_ARROW); SetIndexStyle(1,DRAW_ARROW); } SetIndexArrow(0,code); SetIndexArrow(1,code); SetIndexBuffer(0,Buf1); SetIndexBuffer(1,Buf2); SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); SetIndexLabel(0,Rem); SetIndexLabel(1,Rem); SetIndexStyle(2,DRAW_ARROW,EMPTY,2); SetIndexArrow(2,241); SetIndexBuffer(2, BuyBuffer); SetIndexStyle(3,DRAW_ARROW,EMPTY,2); SetIndexArrow(3,242); SetIndexBuffer(3, SellBuffer); return(0); } int deinit() { ObjectsDeleteAll(); Comment(""); ArrayInitialize(Buf1,0.0); ArrayInitialize(Buf2,0.0); for(int i=1;i<=LevDP;i++){ ObjectDelete("HA_"+i);ObjectDelete("LA_"+i); ObjectDelete("HL_"+i);ObjectDelete("LL_"+i); ObjectDelete("HHL_"+i);ObjectDelete("HLL_"+i); ObjectDelete("HCL_"+i);ObjectDelete("LCL_"+i); for(int j=0;j<4;j++) {ObjectDelete("HTL_"+i+j);ObjectDelete("LTL_"+i+j);} } } int start(){ if (qBars!=Bars){ deinit(); Sleep(1000); qBars=Bars; qTime=0; return(0);} if (qTime==Time[0]) return(0); qTime=Time[0]; // çàïóñêàåöà òîêà íà 1ì òèêå // çàïîëíèëè è îòîáðàçèëè òî÷êè äåìàðêà if (showBars==0) showBars=Bars-LevDP; for (int cnt=showBars;cnt>LevDP;cnt--) { Buf1[cnt]=DemHigh(cnt,LevDP); Buf2[cnt]=DemLow(cnt,LevDP); } string Comm; double j; int m,s,k; m=Time[0]+Period()*60-CurTime(); j=m/60.0; s=m%60; m=(m-m%60)/60; Comm=Comm+"Demark with alerts"; Comm=Comm+( m + " minutes " + s + " seconds left to bar end")+"\n"; if (Comments){Comment(Comm);}else{Comment("Demark with alerts" + "\n" + m + " minutes " + s + " seconds left to bar end" +"\n");} Comm=Comm+"Trend Line["+On(TrendLine)+"]; Channel ["+On(ChannelLine)+ "]; Breakout level ["+On(HorizontLine)+"]; Targets ["+On(TakeLines)+"]\n"; for(cnt=1;cnt<=qSteps;cnt++) Comm=Comm+(TDMain(cnt)); Comm=Comm+"———— © GameOver ————"; if (Comments==true) Comment(Comm); return(0); } string TDMain(int Step){ int H1,H2,L1,L2,qExt,i,col; double tmp,qTL,qLevel,HT[4],LT[4]; bool isHitch; string Comm="»—»—» Step "+Step+" of "+qSteps+" (BackStep "+BackStep+")\n",Text,Rem,qp; static datetime timealertupper, timealertlower; // äëÿ DownTrendLines if (Trend<=0){ Comm=Comm+"» "+Col[Step*2-2]+" DownTrendLine "; col=ColNum[Step*2-2]; H1=GetTD(Step+BackStep,Buf1); H2=GetNextHighTD(H1); qTL=(High[H2]-High[H1])/(H2-H1); qExt=Lowest(NULL,0,MODE_LOW,H2-H1-1,H1+1); // ëîêàëüíûé ìèíèìóì ìåæäó òî÷êàìè qLevel=High[H2]-qTL*(H2); if (Step+BackStep==1) qLevel=qLevel-qTL*startBar; if (H1<0 || H2<0) Comm=Comm+"not enough points on the chart for construction\n"; else { Comm=Comm+"["+DoubleToStr(High[H2],qPoint)+"»"+DoubleToStr(High[H1],qPoint)+"]"; Comm=Comm+"; Level "+DoubleToStr(qLevel,qPoint); if (Step+BackStep==1) { if (startBar>0) Comm=Comm+"; Future Bar "+UpHitch(-1,qLevel); else Comm=Comm+"; Last Bar "+UpHitch(startBar,qLevel); } Comm=Comm+"\n"; // Àíàëèç - áûë ëè ïðîáîé òðåíäîâîé ëèíèè i=H1;isHitch=false;Text=""; while(i>0 && isHitch==false){ BuyBuffer[i]=0; tmp=High[H2]-qTL*(H2-i); Rem="HA_"+Step; if (Close[i]>tmp){ qp=UpHitch(i,tmp); if (qp!=""){ isHitch=true; Text=Text+"Source "+DoubleToStr(tmp,qPoint)+" "+qp; BuyBuffer[i]=Low[i]-DotPip*Point; if (timealertupper!=Time[i]){ if (ShowAlerts){ Alert ("MOUTEKI: Upper trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid); } ObjectCreate(Rem,OBJ_ARROW,0,0,0,0,0); ObjectSet(Rem,OBJPROP_COLOR,col); ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,241); //} if (EmailAlert){ SendMail("MOUTEKI: Upper trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid, "MOUTEKI: Upper trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid + "\n" + "Alerts by LightKeeper. Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak9489112d586b080eb63abb243f722019').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy9489112d586b080eb63abb243f722019 = 'martkoz' + '@'; addy9489112d586b080eb63abb243f722019 = addy9489112d586b080eb63abb243f722019 + 'optusnet' + '.' + 'com' + '.' + 'au'; var addy_text9489112d586b080eb63abb243f722019 = 'martkoz' + '@' + 'optusnet' + '.' + 'com' + '.' + 'au';document.getElementById('cloak9489112d586b080eb63abb243f722019').innerHTML += ''+addy_text9489112d586b080eb63abb243f722019+''; "); } timealertupper=Time[i]; } ///////////////////////////////////// ObjectCreate(Rem,OBJ_ARROW,0,0,0,0,0); ObjectSet(Rem,OBJPROP_COLOR,col); ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,241); //////////////////////////////////// if (ShowArrows==true){ while(i>0){ // ïðîáîé îòìåíåí, åñëè ïîñëå ïðîáîÿ áûë íîâûé ëîó èëè çàêðûòèå íèæå i--; if (Low[i]<Low[qExt] || Close[i]<(Low[qExt]+(High[H1]-Low[qExt])*0.236)){ Text=Text+" (cancel)"; ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,251); break; } } } } else { Text=Text+"False "+DoubleToStr(tmp,qPoint)+"; "; ObjectDelete(Rem);} } i--; } if (Text=="") Text="No breakout"; Comm=Comm+Text+"\n"; // end analysis Rem="HL_"+Step; // ñîáñíî ëèíèÿ òðåíäà if (CustomFeatures){trendcol=DownTrendColor;}else{trendcol=col;} if (TrendLine){ if (CustomFeatures==false){trendwidth=3-MathMin(2,Step);}else{trendwidth=TrendlineWidth;} ObjectCreate(Rem,OBJ_TREND,0,0,0,0,0); ObjectSet(Rem,OBJPROP_TIME1,Time[H2]);ObjectSet(Rem,OBJPROP_TIME2,Time[H1]); ObjectSet(Rem,OBJPROP_PRICE1,High[H2]);ObjectSet(Rem,OBJPROP_PRICE2,High[H1]); ObjectSet(Rem,OBJPROP_COLOR,trendcol); ObjectSet(Rem,OBJPROP_WIDTH,trendwidth); } else ObjectDelete(Rem); Rem="HHL_"+Step; // óðîâåíü ïðîáîÿ ëèíèè òðåíäà if (HorizontLine && (Step+BackStep)==1){ ObjectCreate(Rem,OBJ_HLINE,0,0,0,0,0); ObjectSet(Rem,OBJPROP_PRICE1,qLevel); ObjectSet(Rem,OBJPROP_COLOR,trendcol); } else ObjectDelete(Rem); Rem="HCL_"+Step; // ëèíèÿ êàíàëà if (ChannelLine){ ObjectCreate(Rem,OBJ_TREND,0,0,0,0,0); ObjectSet(Rem,OBJPROP_TIME1,Time[qExt]);ObjectSet(Rem,OBJPROP_TIME2,Time[0]); ObjectSet(Rem,OBJPROP_PRICE1,Low[qExt]);ObjectSet(Rem,OBJPROP_PRICE2,Low[qExt]-qTL*qExt); ObjectSet(Rem,OBJPROP_COLOR,trendcol); } else ObjectDelete(Rem); Rem="HTL_"+Step; // ëèíèè öåëåé if (TakeLines){ HT[3]=Low[qExt]+(High[H1]-Low[qExt])*1.618-qLevel; // äîï óðîâåíü HT[0]=High[H2]-qTL*(H2-qExt)-Low[qExt]; HT[1]=High[H2]-qTL*(H2-qExt)-Close[qExt]; qExt=Lowest(NULL,0,MODE_CLOSE,H2-H1,H1); HT[2]=High[H2]-qTL*(H2-qExt)-Close[qExt]; Comm=Comm+"Targets: "; for(i=0;i<4;i++){ qTL=NormalizeDouble(qLevel+HT[i],qPoint); ObjectCreate(Rem+i,OBJ_HLINE,0,0,0,0,0); ObjectSet(Rem+i,OBJPROP_PRICE1,qTL); ObjectSet(Rem+i,OBJPROP_STYLE,STYLE_DOT); ObjectSet(Rem+i,OBJPROP_COLOR,trendcol); Comm=Comm+DoubleToStr(qTL,qPoint)+" ("+DoubleToStr(HT[i]/Point,0)+"p.) "; } Comm=Comm+"\n"; } else { for(i=0;i<4;i++) ObjectDelete(Rem+i); } } } // äëÿ UpTrendLines if (Trend>=0){ Comm=Comm+"» "+Col[Step*2-1]+" UpTrendLine "; col=ColNum[Step*2-1]; L1=GetTD(Step+BackStep,Buf2); L2=GetNextLowTD(L1); qTL=(Low[L1]-Low[L2])/(L2-L1); qExt=Highest(NULL,0,MODE_HIGH,L2-L1-1,L1+1); // ëîêàëüíûé ìèíèìóì ìåæäó òî÷êàìè qLevel=Low[L2]+qTL*L2; if (Step+BackStep==1) qLevel=qLevel+qTL*startBar; if (L1<0 || L2<0) Comm=Comm+"not enough points on the chart for construction\n"; else { Comm=Comm+"["+DoubleToStr(Low[L2],qPoint)+"»"+DoubleToStr(Low[L1],qPoint)+"]"; Comm=Comm+"; Level "+DoubleToStr(qLevel,qPoint); if (Step+BackStep==1) { if (startBar>0) Comm=Comm+"; Future Bar "+DownHitch(-1,qLevel); else Comm=Comm+"; Last Bar "+DownHitch(startBar,qLevel); } Comm=Comm+"\n"; // Àíàëèç - áûë ëè ïðîáîé òðåíäîâîé ëèíèè i=L1;isHitch=false;Text=""; while(i>0 && isHitch==false){ SellBuffer[i]=0; tmp=Low[L2]+qTL*(L2-i); Rem="LA_"+Step; if (Close[i]<tmp){ qp=DownHitch(i,tmp); if (qp!=""){ isHitch=true; Text=Text+"Source "+DoubleToStr(tmp,qPoint)+" "+qp; SellBuffer[i]=High[i]+DotPip*Point; if (timealertlower!=Time[i]){ if(ShowAlerts){ Alert ("MOUTEKI: Lower trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid); } ObjectCreate(Rem,OBJ_ARROW,0,0,0,0,0); ObjectSet(Rem,OBJPROP_COLOR,col); ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,242); //} if (EmailAlert){ SendMail("MOUTEKI: Lower trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid, "MOUTEKI: Lower trendline broken on " + Symbol() + " TF: " + Period() + " @ " + Bid + "\n" + "Alerts by LightKeeper. Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak729a38691355f0c2be214f1aba8cf3a9').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy729a38691355f0c2be214f1aba8cf3a9 = 'martkoz' + '@'; addy729a38691355f0c2be214f1aba8cf3a9 = addy729a38691355f0c2be214f1aba8cf3a9 + 'optusnet' + '.' + 'com' + '.' + 'au'; var addy_text729a38691355f0c2be214f1aba8cf3a9 = 'martkoz' + '@' + 'optusnet' + '.' + 'com' + '.' + 'au';document.getElementById('cloak729a38691355f0c2be214f1aba8cf3a9').innerHTML += ''+addy_text729a38691355f0c2be214f1aba8cf3a9+''; "); } timealertlower=Time[i]; } /////////////////////////////// ObjectCreate(Rem,OBJ_ARROW,0,0,0,0,0); ObjectSet(Rem,OBJPROP_COLOR,col); ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,242); ////////////////////////////// if (ShowArrows==true){ while(i>0){ // ïðîáîé îòìåíåí, åñëè ïîñëå ïðîáîÿ áûë íîâûé õàé èëè çàêðûòèå âûøå i--; if (High[i]>High[qExt] || Close[i]>High[qExt]-(High[qExt]-Low[L1])*0.236){ Text=Text+" (cancel)"; ObjectSet(Rem,OBJPROP_PRICE1,Low[i]-Point); ObjectSet(Rem,OBJPROP_TIME1,Time[i]); ObjectSet(Rem,OBJPROP_ARROWCODE,251); break; } } } } else { Text=Text+"False "+DoubleToStr(tmp,qPoint)+"; "; ObjectDelete(Rem);} } i--; } if (Text=="") Text="No breakout"; Comm=Comm+Text+"\n"; // end analysis Rem="LL_"+Step; // ñîáñíî ëèíèÿ òðåíäà if (CustomFeatures){trendcol=UpTrendColor;}else{trendcol=col;} if (TrendLine==1) { if (CustomFeatures==false){trendwidth=3-MathMin(2,Step);}else{trendwidth=TrendlineWidth;} ObjectCreate(Rem,OBJ_TREND,0,0,0,0,0); ObjectSet(Rem,OBJPROP_TIME1,Time[L2]);ObjectSet(Rem,OBJPROP_TIME2,Time[L1]); ObjectSet(Rem,OBJPROP_PRICE1,Low[L2]);ObjectSet(Rem,OBJPROP_PRICE2,Low[L1]); ObjectSet(Rem,OBJPROP_COLOR,trendcol); ObjectSet(Rem,OBJPROP_WIDTH,trendwidth); } else ObjectDelete(Rem); Rem="HLL_"+Step; // óðîâåíü ïðîáîÿ ëèíèè òðåíäà if (HorizontLine && (Step+BackStep)==1){ ObjectCreate(Rem,OBJ_HLINE,0,0,0,0,0); ObjectSet(Rem,OBJPROP_PRICE1,qLevel); ObjectSet(Rem,OBJPROP_COLOR,trendcol); } else ObjectDelete(Rem); Rem="LCL_"+Step; // ëèíèÿ êàíàëà if (ChannelLine){ ObjectCreate(Rem,OBJ_TREND,0,0,0,0,0); ObjectSet(Rem,OBJPROP_TIME1,Time[qExt]);ObjectSet(Rem,OBJPROP_TIME2,Time[0]); ObjectSet(Rem,OBJPROP_PRICE1,High[qExt]);ObjectSet(Rem,OBJPROP_PRICE2,High[qExt]+qTL*qExt); ObjectSet(Rem,OBJPROP_COLOR,trendcol); } else ObjectDelete(Rem); Rem="LTL_"+Step; if (TakeLines){ // ëèíèè öåëåé LT[3]=qLevel-High[qExt]+(High[qExt]-Low[L1])*1.618; // äîï óðîâåíü LT[0]=High[qExt]-qTL*(L2-qExt)-Low[L2]; LT[1]=Close[qExt]-qTL*(L2-qExt)-Low[L2]; qExt=Highest(NULL,0,MODE_CLOSE,L2-L1,L1); LT[2]=Close[qExt]-qTL*(L2-qExt)-Low[L2]; Comm=Comm+"Targets: "; for(i=0;i<4;i++){ qTL=NormalizeDouble(qLevel-LT[i],qPoint); ObjectCreate(Rem+i,OBJ_HLINE,0,0,0,0,0); ObjectSet(Rem+i,OBJPROP_PRICE1,qTL); ObjectSet(Rem+i,OBJPROP_STYLE,STYLE_DOT); ObjectSet(Rem+i,OBJPROP_COLOR,trendcol); Comm=Comm+DoubleToStr(qTL,qPoint)+" ("+DoubleToStr(LT[i]/Point,0)+"p.) "; } Comm=Comm+"\n"; } else { for(i=0;i<4;i++) ObjectDelete(Rem+i); } } } return(Comm); } int GetTD(int P, double Arr[]){ int i=0,j=0; while(j<P){ i++; while(Arr[i]==0){i++;if(i>showBars-2)return(-1);} j++;} return (i); } int GetNextHighTD(int P){ int i=P+1; while(Buf1[i]<=High[P]){i++;if(i>showBars-2)return(-1);} return (i); } int GetNextLowTD(int P){ int i=P+1; while(Buf2[i]>=Low[P] || Buf2[i]==0){i++;if(i>showBars-2)return(-1);} return (i); } // ðåêóðñèâíàÿ ïðîâåðêà íà óñëîâèÿ Äåìàðêà (õàé), âîçâðàùàåò çíà÷åíèå èëè 0 double DemHigh(int cnt, int sh){ if (High[cnt]>=High[cnt+sh] && High[cnt]>High[cnt-sh]) { if (sh>1) return(DemHigh(cnt,sh-1)); else return(High[cnt]); } else return(0); } // ðåêóðñèâíàÿ ïðîâåðêà íà óñëîâèÿ Äåìàðêà (ëîó), âîçâðàùàåò çíà÷åíèå èëè 0 double DemLow(int cnt, int sh){ if (Low[cnt]<=Low[cnt+sh] && Low[cnt]<Low[cnt-sh]) { if (sh>1) return(DemLow(cnt,sh-1)); else return(Low[cnt]); } else return(0); } string On(bool On){ if (On) return("on"); else return("off"); } string UpHitch(int P, double qLevel){ // îïðåäåëåíèå êâàëèôèêàòîðîâ ïðîðûâà ââåðõ string Comm=""; if (Close[P+1]<Close[P+2]) Comm=Comm+" 1"; if (P>=0 && Open[P]>qLevel) Comm=Comm+" 2"; if (2*Close[P+1]-Low[P+1]<qLevel) Comm=Comm+" 3"; if (Comm!="") Comm="[ Break Qualificator:"+Comm+" ]"; return(Comm); } string DownHitch(int P, double qLevel){ // îïðåäåëåíèå êâàëèôèêàòîðîâ ïðîðûâà âíèç string Comm=""; if (Close[P+1]>Close[P+2]) Comm=Comm+" 1"; if (P>=0 && Open[P]<qLevel) Comm=Comm+" 2"; if (2*Close[P+1]-High[P+1]>qLevel) Comm=Comm+" 3"; if (Comm!="") Comm="[ Break Qualificator:"+Comm+" ]"; return(Comm); }http://www.expert-advisor.it/metatrader-indicators-free
Indicatore MetaTrader //+------------------------------------------------------------------+ //| Avg Daily Range.mq4 | //| Copyright © 2005, tageiger aka Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloakad5573b0f14e8726b31ab50310d8bf47').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addyad5573b0f14e8726b31ab50310d8bf47 = 'fxid10t' + '@'; addyad5573b0f14e8726b31ab50310d8bf47 = addyad5573b0f14e8726b31ab50310d8bf47 + 'yahoo' + '.' + 'com'; var addy_textad5573b0f14e8726b31ab50310d8bf47 = 'fxid10t' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloakad5573b0f14e8726b31ab50310d8bf47').innerHTML += ''+addy_textad5573b0f14e8726b31ab50310d8bf47+''; | //| http://www.metatrader.org | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, tageiger aka Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak196888ea6593753b3bbba0198b6ad8c0').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy196888ea6593753b3bbba0198b6ad8c0 = 'fxid10t' + '@'; addy196888ea6593753b3bbba0198b6ad8c0 = addy196888ea6593753b3bbba0198b6ad8c0 + 'yahoo' + '.' + 'com'; var addy_text196888ea6593753b3bbba0198b6ad8c0 = 'fxid10t' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloak196888ea6593753b3bbba0198b6ad8c0').innerHTML += ''+addy_text196888ea6593753b3bbba0198b6ad8c0+''; " #property link "http://www.metatrader.org" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 SpringGreen #property indicator_color3 Tomato //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double rng,sum.rng,avg.rng; int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer3); //---- return(0);} int deinit() {return(0);} int start() { int counted_bars=IndicatorCounted(); rng=0;sum.rng=0;avg.rng=0; for(int i=0;i<Bars;i++) { rng=(iHigh(Symbol(),Period(),i)-iLow(Symbol(),Period(),i)); sum.rng+=rng; } int db=iBars(Symbol(),Period()); avg.rng=sum.rng/db; // for(int t=0;t<db;t++) { for(int s=0;s<Bars;s++) { ExtMapBuffer2[s]=(iOpen(Symbol(),Period(),s)+(avg.rng/2)); ExtMapBuffer3[s]=(iOpen(Symbol(),Period(),s)-(avg.rng/2)); }// } Comment("Last Tick: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),"\n", "Sum of Period Ranges:",sum.rng,"\n", "Average Range:",avg.rng,"\n", "Total Bars:",i+1); return(0);} //+------------------------------------------------------------------+
Indicatore MetaTrader //+------------------------------------------------------------------+ //| Avg Daily Range.mq4 | //| Copyright © 2005, tageiger aka Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak1f8da96bc0ce4c98b1033c4bd4120f63').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy1f8da96bc0ce4c98b1033c4bd4120f63 = 'fxid10t' + '@'; addy1f8da96bc0ce4c98b1033c4bd4120f63 = addy1f8da96bc0ce4c98b1033c4bd4120f63 + 'yahoo' + '.' + 'com'; var addy_text1f8da96bc0ce4c98b1033c4bd4120f63 = 'fxid10t' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloak1f8da96bc0ce4c98b1033c4bd4120f63').innerHTML += ''+addy_text1f8da96bc0ce4c98b1033c4bd4120f63+''; | //| http://www.metatrader.org | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, tageiger aka Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo. document.getElementById('cloak159c4ed3c714cbe88416ab395359b1c4').innerHTML = ''; var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy159c4ed3c714cbe88416ab395359b1c4 = 'fxid10t' + '@'; addy159c4ed3c714cbe88416ab395359b1c4 = addy159c4ed3c714cbe88416ab395359b1c4 + 'yahoo' + '.' + 'com'; var addy_text159c4ed3c714cbe88416ab395359b1c4 = 'fxid10t' + '@' + 'yahoo' + '.' + 'com';document.getElementById('cloak159c4ed3c714cbe88416ab395359b1c4').innerHTML += ''+addy_text159c4ed3c714cbe88416ab395359b1c4+''; " #property link "http://www.metatrader.org" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 SpringGreen #property indicator_color3 Tomato //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double rng,sum.rng,avg.rng; int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer3); //---- return(0);} int deinit() {return(0);} int start() { int counted_bars=IndicatorCounted(); rng=0;sum.rng=0;avg.rng=0; for(int i=0;i<Bars;i++) { rng=(iHigh(Symbol(),Period(),i)-iLow(Symbol(),Period(),i)); sum.rng+=rng; } int db=iBars(Symbol(),Period()); avg.rng=sum.rng/db; // for(int t=0;t<db;t++) { for(int s=0;s<Bars;s++) { ExtMapBuffer2[s]=(iOpen(Symbol(),Period(),s)+(avg.rng/2)); ExtMapBuffer3[s]=(iOpen(Symbol(),Period(),s)-(avg.rng/2)); }// } Comment("Last Tick: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),"\n", "Sum of Period Ranges:",sum.rng,"\n", "Average Range:",avg.rng,"\n", "Total Bars:",i+1); return(0);} //+------------------------------------------------------------------+
Indicatore MetaTrader //+------------------------------------------------------------------+ //| Auto-Pivot Plotter V1-41.mq4 | //| Copyright © 2006, Elton Treloar | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Elton Treloar" #property link "" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 Red #property indicator_color3 Red #property indicator_color4 Yellow #property indicator_color5 DodgerBlue #property indicator_color6 DodgerBlue #property indicator_color7 DodgerBlue #property indicator_color8 LimeGreen #property indicator_style1 STYLE_SOLID #property indicator_style2 STYLE_SOLID #property indicator_style3 STYLE_SOLID #property indicator_style4 STYLE_SOLID #property indicator_style5 STYLE_SOLID #property indicator_style6 STYLE_SOLID #property indicator_style7 STYLE_SOLID #property indicator_style8 STYLE_SOLID //---- input parameters extern int StartHour=0; extern int StartMinute=0; extern int DaysToPlot=15; //---- buffers double Res3[]; double Res2[]; double Res1[]; double Pivot[]; double Supp1[]; double Supp2[]; double Supp3[]; double Extra1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(0,Res3); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(1,Res2); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(2,Res1); SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1); SetIndexBuffer(3,Pivot); SetIndexStyle(4,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(4,Supp1); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(5,Supp2); SetIndexStyle(6,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(6,Supp3); SetIndexStyle(7,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(7,Extra1); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; int StartMinutesIntoDay=(StartHour*60)+StartMinute; // 8' o'clock x 60 = 480 int CloseMinutesIntoDay=StartMinutesIntoDay-Period(); // // **************************************************** // Check That cloes time isn't now a negative number. // Correct if it is by adding a full day's worth // of minutes. // **************************************************** if (CloseMinutesIntoDay<0) { CloseMinutesIntoDay=CloseMinutesIntoDay+1440; } // **************************************************** // Establish the nuber of bars in a day. // **************************************************** int BarsInDay=1440/Period(); // ****************************************************************************************** // ****************************************************************************************** // Main Loop // ****************************************************************************************** // ****************************************************************************************** for(int i=0; i<limit; i++) { // *************************************************************************** // Only do all this if we are within the plotting range we want. // i.e. DaysToPlot // If DaysToPlot is "0" (zero) we plot ALL available data. This can be // VERY slow with a large history and at small time frames. Expect to // wait if plotting a year or more on a say a five minute chart. On my PC // two years of data at Five Minutes takes around 30 seconds per indicator. // i.e. 30 seconds for main pivot levels indicator then another 30 seconds // to plot the seperate mid-levels indicator. // *************************************************************************** if ( (i<((DaysToPlot+1)*BarsInDay))||DaysToPlot==0) // Used to limit the number of days { // that are mapped out. Less waiting ;) // ***************************************************** // Find previous day's opening and closing bars. // ***************************************************** int PreviousClosingBar = FindLastTimeMatchFast(CloseMinutesIntoDay,i+1); int PreviousOpeningBar = FindLastTimeMatchFast(StartMinutesIntoDay,PreviousClosingBar+1); double PreviousHigh= High[PreviousClosingBar]; double PreviousLow = Low [PreviousClosingBar]; double PreviousClose = Close[PreviousClosingBar]; // ***************************************************** // Find previous day's high and low. // ***************************************************** for (int SearchHighLow=PreviousClosingBar;SearchHighLow<(PreviousOpeningBar+1);SearchHighLow++) { if (High[SearchHighLow]>PreviousHigh) PreviousHigh=High[SearchHighLow]; if (Low[SearchHighLow]<PreviousLow) PreviousLow=Low[SearchHighLow]; } // ************************************************************************ // Calculate Pivot lines and map into indicator buffers. // ************************************************************************ double P = (PreviousHigh+PreviousLow+PreviousClose)/3; double R1 = (2*P)-PreviousLow; double S1 = (2*P)-PreviousHigh; double R2 = P+(PreviousHigh - PreviousLow); double S2 = P-(PreviousHigh - PreviousLow); double R3 = (2*P)+(PreviousHigh-(2*PreviousLow)); double S3 = (2*P)-((2* PreviousHigh)-PreviousLow); Pivot[i]=P; Res1[i] =R1; Res2[i] =R2; Res3[i] =R3; Supp1[i]=S1; Supp2[i]=S2; Supp3[i]=S3; // Extra1[i]=OpenPriceAt+i; // ********************************************** // Calculate the mid-levels in to the buffers. // (for mid-levels version) // **********************************************(Twe) // Res1[i] =((R1-P)/2)+P; //M3 // Res2[i] =((R2-R1)/2)+R1; //M4 // Res3[i] =((R3-R2)/2)+R2; // Supp1[i]=((P-S1)/2)+S1; //M2 // Supp2[i]=((S1-S2)/2)+S2; //M1 // Supp3[i]=((S2-S3)/2)+S3; } //End of 'DaysToPlot 'if' statement. } // *************************************************************************************** // End of Main Loop // *************************************************************************************** // ***************************************** // Return from Start() (Main Routine) return(0); } //+-------------------------------------------------------------------------------------------------------+ // END Custom indicator iteration function //+-------------------------------------------------------------------------------------------------------+ // ***************************************************************************************** // ***************************************************************************************** // ----------------------------------------------------------------------------------------- // The following routine will use "StartingBar"'s time and use it to find the // general area that SHOULD contain the bar that matches "TimeToLookFor" // ----------------------------------------------------------------------------------------- int FindLastTimeMatchFast(int TimeToLookFor,int StartingBar) { int StartingBarsTime=(TimeHour(Time[StartingBar])*60)+TimeMinute(Time[StartingBar]); // *************************************************** // Check that our search isn't on the otherside of // the midnight boundary and correct for calculations // *************************************************** if (StartingBarsTime<TimeToLookFor) { StartingBarsTime=StartingBarsTime+1440; } // *************************************************** // Find out where the bar SHOULD be in time. // *************************************************** int HowFarBack=StartingBarsTime-TimeToLookFor; // *************************************************** // Translate that into Bars // *************************************************** int HowManyBarsBack=HowFarBack/Period(); // *************************************************** // We've found our starting point // Calculate it's relative time in minutes. // *************************************************** int SuggestedBar=StartingBar+HowManyBarsBack; int SuggestedBarsTime=(TimeHour(Time[SuggestedBar])*60)+TimeMinute(Time[SuggestedBar]); // *************************************************** // If we have what we're after let's just skip the // crap and return the position of the bar in the // chart to our main routine // *************************************************** if (SuggestedBarsTime==TimeToLookFor) { return(SuggestedBar); } // *************************************************** // Else find the difference in time from where we // were supposed to find the bar. // *************************************************** int DeltaTimeFound=TimeToLookFor-SuggestedBarsTime; int DeltaBarFound=DeltaTimeFound/Period(); // *************************************************** // I'd be worried if Delta was below zero. Would mean // that we have EXTRA bars in that day. Unlikely in // the extreme. // So I'm only checking for the other case. // ...now let's search in a narrow range to find that // bar we are after... // *************************************************** if (DeltaTimeFound>0) { for (int SearchCount=SuggestedBar ;SearchCount>(SuggestedBar-DeltaBarFound-2) ;SearchCount--) { // ****************************************************************************** // Find time (in minutes) of the current bar AND the two bars either side of it. // This is done to allow for any missing bars in the data. i.e. If THE bar you // were after were to be missing you'd never get a valid close/open time. // This is the same reason for searching rather than just looking back a certain // number of bars from the close time. Missing bars upset the count back and // screw up all pivot calculations. There is still room for error but it's improved. // The best calculations will come from having the best data. ...of course. :) // ****************************************************************************** // int PreviousBarsTime=(TimeHour(Time[SearchCount+1])*60)+TimeMinute(Time[SearchCount+1]); int CurrentBarsTime=(TimeHour(Time[SearchCount])*60)+TimeMinute(Time[SearchCount]); int NextBarsTime=(TimeHour(Time[SearchCount-1])*60)+TimeMinute(Time[SearchCount-1]); if (CurrentBarsTime==TimeToLookFor) { return(SearchCount); // *** If current bar is what we are after than lets get out. // *** without mucking about with the rest of the checks. } // ********************************** // Check that previous bar doesn't // lay on a different day. // Adjust if it is // ********************************** if(PreviousBarsTime>CurrentBarsTime) { PreviousBarsTime=PreviousBarsTime-1440; } // ********************************** // Check that following bar doesn't // lay on a different day. // Adjust if it is. // ********************************** if(NextBarsTime<CurrentBarsTime) { NextBarsTime=NextBarsTime+1440; } // ****************************************** // If this is the best we can get // to the actual bar we are after, then // exit, returning current bar number. // ******************************************* if(PreviousBarsTime<TimeToLookFor) { if( TimeToLookFor<NextBarsTime) { return(SearchCount); } } } } return (SuggestedBar); }
Indicatore MetaTrader //+------------------------------------------------------------------+ //| AutoDayFibs V1.0 | //| | //| Copyright © 2005, Jason Robinson | //| (jasonrobinsonuk, jnrtrading) | //| http://www.jnrtrading.co.uk | //| | //| Created by jnrtrading | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, Jason Robinson (jnrtrading)" #property link "http://www.jnrtrading.co.uk" #property indicator_chart_window extern int daysBackForHigh = 1; extern int daysBackForLow = 1; //---- buffers double Rates[][6]; double fib000, fib236, fib382, fib50, fib618, fib100, fib1618, fib2618, fib4236, range, prevRange, high, low; bool objectsExist, highFirst; prevRange = 0; objectsExist = false; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //prevRange = 0; //objectsExist = false; //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- ObjectDelete("fib000"); ObjectDelete("fib000_label"); ObjectDelete("fib236"); ObjectDelete("fib236_label"); ObjectDelete("fib382"); ObjectDelete("fib382_label"); ObjectDelete("fib50"); ObjectDelete("fib50_label"); ObjectDelete("fib618"); ObjectDelete("fib618_label"); ObjectDelete("fib100"); ObjectDelete("fib100_label"); ObjectDelete("fib1618"); ObjectDelete("fib1618_label"); ObjectDelete("fib2618"); ObjectDelete("fib2618_label"); ObjectDelete("fib4236"); ObjectDelete("fib4236_label"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i = 0; //---- //Print(prevRange); ArrayCopyRates(Rates, Symbol(), PERIOD_D1); high = Rates[daysBackForHigh][3]; low = Rates[daysBackForLow][2]; range = high - low; while(true) { if(High[i] == high) { highFirst = true; break; } else if(Low[i] == low) { highFirst = false; break; } i++; } //Print(highFirst); // Delete Objects if necessary if (prevRange != range) { ObjectDelete("fib000"); ObjectDelete("fib000_label"); ObjectDelete("fib236"); ObjectDelete("fib236_label"); ObjectDelete("fib382"); ObjectDelete("fib382_label"); ObjectDelete("fib50"); ObjectDelete("fib50_label"); ObjectDelete("fib618"); ObjectDelete("fib618_label"); ObjectDelete("fib100"); ObjectDelete("fib100_label"); ObjectDelete("fib1618"); ObjectDelete("fib1618_label"); ObjectDelete("fib2618"); ObjectDelete("fib2618_label"); ObjectDelete("fib4236"); ObjectDelete("fib4236_label"); objectsExist = false; prevRange = range; //Print("Objects do not exist"); } if (highFirst == true) { fib000 = low; fib236 = (range * 0.236) + low; fib382 = (range * 0.382) + low; fib50 = (high + low) / 2; fib618 = (range * 0.618) + low; fib100 = high; fib1618 = (range * 0.618) + high; fib2618 = (range * 0.618) + (high + range); fib4236 = (range * 0.236) + high + (range * 3); } else if (highFirst == false) { fib000 = high; fib236 = high - (range * 0.236); fib382 = high - (range * 0.382); fib50 = (high + low) / 2; fib618 = high - (range * 0.618); fib100 = low; fib1618 = low - (range * 0.618); fib2618 = (low - range) - (range * 0.618);// + (high + range); fib4236 = low - (range * 3) - (range * 0.236);// + high + (range * 3); } if (objectsExist == false) { ObjectCreate("fib000", OBJ_HLINE, 0, Time[40], fib000); ObjectSet("fib000", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("fib000", OBJPROP_COLOR, Orange); ObjectCreate("fib000_label", OBJ_TEXT, 0, Time[0], fib000); ObjectSetText("fib000_label"," 0.0", 8, "Times", Black); ObjectCreate("fib236", OBJ_HLINE, 0, Time[40], fib236); ObjectSet("fib236", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("fib236", OBJPROP_COLOR, Orange); ObjectCreate("fib236_label", OBJ_TEXT, 0, Time[0], fib236); ObjectSetText("fib236_label"," 23.6", 8, "Times", Black); ObjectCreate("fib382", OBJ_HLINE, 0, Time[40], fib382); ObjectSet("fib382", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("fib382", OBJPROP_COLOR, Orange); ObjectCreate("fib382_label", OBJ_TEXT, 0, Time[0], fib382); ObjectSetText("fib382_label"," 38.2", 8, "Times", Black); ObjectCreate("fib50", OBJ_HLINE, 0, Time[40], fib50); ObjectSet("fib50", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("fib50", OBJPROP_COLOR, Orange); ObjectCreate("fib50_label", OBJ_TEXT, 0, Time[0], fib50); ObjectSetText("fib50_label"," 50.0", 8, "Times", Black); ObjectCreate("fib618", OBJ_HLINE, 0, Time[40], fib618); ObjectSet("fib618", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("fib618", OBJPROP_COLOR, Orange); ObjectCreate("fib618_label", OBJ_TEXT, 0, Time[0], fib618); ObjectSetText("fib618_label"," 61.8", 8, "Times", Black); ObjectCreate("fib100", OBJ_HLINE, 0, Time[40], fib100); ObjectSet("fib100", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("fib100", OBJPROP_COLOR, Orange); ObjectCreate("fib100_label", OBJ_TEXT, 0, Time[0], fib100); ObjectSetText("fib100_label"," 100.0", 8, "Times", Black); ObjectCreate("fib1618", OBJ_HLINE, 0, Time[40], fib1618); ObjectSet("fib1618", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("fib1618", OBJPROP_COLOR, Orange); ObjectCreate("fib1618_label", OBJ_TEXT, 0, Time[0], fib1618); ObjectSetText("fib1618_label"," 161.8", 8, "Times", Black); ObjectCreate("fib2618", OBJ_HLINE, 0, Time[40], fib2618); ObjectSet("fib2618", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("fib2618", OBJPROP_COLOR, Orange); ObjectCreate("fib2618_label", OBJ_TEXT, 0, Time[0], fib2618); ObjectSetText("fib2618_label"," 261.8", 8, "Times", Black); ObjectCreate("fib4236", OBJ_HLINE, 0, Time[40], fib4236); ObjectSet("fib4236", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet("fib4236", OBJPROP_COLOR, Orange); ObjectCreate("fib4236_label", OBJ_TEXT, 0, Time[0], fib4236); ObjectSetText("fib4236_label"," 423.6", 8, "Times", Black); //Print("Objects Exist"); } //---- return(0); } //+------------------------------------------------------------------+
Indicatore MetaTrader //+------------------------------------------------------------------+ //| ATR ratio.mq4 | //| Copyright © 2005, Luis Guilherme Damiani | //| http://www.damianifx.com.br | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, Luis Guilherme Damiani" #property link "http://www.damianifx.com.br" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Silver #property indicator_color2 Violet //---- input parameters extern int short_atr=7; extern int long_atr=49; extern double triglevel=1.00; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); //Comment("ATR ratio= "+short_atr+" / "+long_atr); for(int i=0;i<Bars-counted_bars;i++) { ExtMapBuffer1[i]=triglevel; double sa=iATR(NULL,0,short_atr,i); ExtMapBuffer2[i]= sa/iATR(NULL,0,long_atr,i); } //---- //---- return(0); } //+------------------------------------------------------------------+
Indicatore MetaTrader //+------------------------------------------------------------------+ //| ATR Levels New.mq4 | //| Tamir Bleicher | //+------------------------------------------------------------------+ #property copyright "Tamir Bleicher" #property indicator_chart_window extern int ATRPeriod = 10; extern string TimeFrame = "D"; extern bool IgnoreSunday = true; extern int MinVolume = 1; extern color DynamicLevel = Teal; extern color StaticLevel=Indigo; extern color OpenLevel=Navy; extern int LevelBarDisplay=40; extern string Remark1 = "=========================================================================="; extern string Remark2 = "TimeFrames: MN-Monthly W-Weekly D-Daily H4-4 Hours H1- 1 Hour M30-30 Minutes M15-15 Minutes M5-5 Minutes M1-1 Minute =="; extern string Remark3 = "IgnoreSunday is relevant only for Daily levels"; extern string Remark4 = "MinVolue is the minimum volume to take in ATR calculation in order to skip holidays"; extern string Remark5 = "LevelBarDisplay is the line titles and value position in bars, counting backward from the last bar"; extern string Remark6 = "Levels are: Dynamic levels (support and resist), Static Levels (support and resist) and open period level"; double rates_d1[][6]; double Static_Resist, Dynamic_Resist, Static_Support, Dynamic_Support, atr; int periods, TF; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- if (TimeFrame=="MN" || TimeFrame=="mn" || TimeFrame=="M" || TimeFrame=="m") TF=PERIOD_MN1; else if (TimeFrame=="W" || TimeFrame=="w") TF=PERIOD_W1; else if (TimeFrame=="D" || TimeFrame=="d") TF=PERIOD_D1; else if (TimeFrame=="H4" || TimeFrame=="h4") TF=PERIOD_H4; else if (TimeFrame=="H1" || TimeFrame=="h1") TF=PERIOD_H1; else if (TimeFrame=="M30" || TimeFrame=="m30") TF=PERIOD_M30; else if (TimeFrame=="M15" || TimeFrame=="m15") TF=PERIOD_M15; else if (TimeFrame=="M5" || TimeFrame=="m5") TF=PERIOD_M5; else if (TimeFrame=="M1" || TimeFrame=="m1") TF=PERIOD_M1; else TF=PERIOD_D1; return(0); } int deinit() { ObjectDelete("ATR Static Resist"); ObjectDelete("ATR Static Support"); ObjectDelete("ATR Static Support Label"); ObjectDelete("ATR Static Resist Label"); ObjectDelete("Period Open"); ObjectDelete("ATR Dynamic Resist"); ObjectDelete("ATR Dynamic Support"); ObjectDelete("ATR Dynamic Support Label"); ObjectDelete("ATR Dynamic Resist Label"); ObjectDelete("Period Open Label"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); string Remark; int Yesterday; ArrayCopyRates(rates_d1, Symbol(), TF); atr = ATR(Symbol(), TF, ATRPeriod, 1, IgnoreSunday); switch(TF) { case PERIOD_MN1: Remark="(Monthly)"; break; case PERIOD_W1: Remark="(Weekly)"; break; case PERIOD_D1: if (IgnoreSunday) Remark="(Daily ignoring Sundays)"; else Remark="(Daily including Sundays)"; break; case PERIOD_H4: Remark="(4 Hours)"; break; case PERIOD_H1: Remark="(1 Hour)"; break; case PERIOD_M30: Remark="(30 Minutes)"; break; case PERIOD_M15: Remark="(15 Minutes)"; break; case PERIOD_M5: Remark="(5 Minutes)"; break; case PERIOD_M1: Remark="(1 Minute)"; break; } Comment("ATR (",ATRPeriod,") = ",atr," ",Remark); if (TF==PERIOD_D1 && IgnoreSunday && TimeDayOfWeek(iTime(NULL,TF,1))==0) Yesterday=2; else Yesterday=1; Static_Support = rates_d1[Yesterday][3] - atr; Static_Resist = rates_d1[Yesterday][2] + atr; Dynamic_Support = rates_d1[0][3] - atr; Dynamic_Resist = rates_d1[0][2] + atr; if (ObjectFind("ATR Static Resist") != 0) { ObjectCreate("ATR Static Resist",OBJ_HLINE,0,Time[0],Static_Resist); ObjectSet("ATR Static Resist",OBJPROP_COLOR,StaticLevel); ObjectSet("ATR Static Resist",OBJPROP_WIDTH,1); } else { ObjectMove("ATR Static Resist", 0,Time[0],Static_Resist); } if (ObjectFind("ATR Static Support") != 0) { ObjectCreate("ATR Static Support",OBJ_HLINE,0,Time[0],Static_Support); ObjectSet("ATR Static Support",OBJPROP_COLOR,StaticLevel); ObjectSet("ATR Static Support",OBJPROP_WIDTH,1); } else { ObjectMove("ATR Static Support", 0,Time[0],Static_Support); } if (ObjectFind("ATR Dynamic Resist") != 0) { ObjectCreate("ATR Dynamic Resist",OBJ_HLINE,0,Time[0],Dynamic_Resist); ObjectSet("ATR Dynamic Resist",OBJPROP_COLOR,DynamicLevel); ObjectSet("ATR Dynamic Resist",OBJPROP_WIDTH,1); } else { ObjectMove("ATR Dynamic Resist", 0,Time[0],Dynamic_Resist); } if (ObjectFind("ATR Dynamic Support") != 0) { ObjectCreate("ATR Dynamic Support",OBJ_HLINE,0,Time[0],Dynamic_Support); ObjectSet("ATR Dynamic Support",OBJPROP_COLOR,DynamicLevel); ObjectSet("ATR Dynamic Support",OBJPROP_WIDTH,1); } else { ObjectMove("ATR Dynamic Support", 0,Time[0],Dynamic_Support); } if (ObjectFind("Period Open") != 0) { ObjectCreate("Period Open",OBJ_HLINE,0,Time[LevelBarDisplay],iOpen(0,TF,0)); ObjectSet("Period Open",OBJPROP_COLOR,OpenLevel); ObjectSet("Period Open",OBJPROP_STYLE,STYLE_DOT); } else { ObjectMove("Period Open", 0,Time[LevelBarDisplay],iOpen(0,TF,0)); } if(ObjectFind("ATR Static Resist Label") != 0) { ObjectCreate("ATR Static Resist Label", OBJ_TEXT, 0, Time[LevelBarDisplay], Static_Resist); ObjectSetText("ATR Static Resist Label", "ATR Static res: " + DoubleToStr(Static_Resist,4), 8, "Verdana", Black); } else { ObjectMove("ATR Static Resist Label", 0, Time[LevelBarDisplay], Static_Resist); } if(ObjectFind("ATR Static Support Label") != 0) { ObjectCreate("ATR Static Support Label", OBJ_TEXT, 0, Time[LevelBarDisplay], Static_Support); ObjectSetText("ATR Static Support Label", "ATR Static sup: " + DoubleToStr(Static_Support,4), 8, "Verdana", Black); } else { ObjectMove("ATR Static Support Label", 0, Time[LevelBarDisplay], Static_Support); } if(ObjectFind("ATR Dynamic Resist Label") != 0) { ObjectCreate("ATR Dynamic Resist Label", OBJ_TEXT, 0, Time[LevelBarDisplay], Dynamic_Resist); ObjectSetText("ATR Dynamic Resist Label", "ATR Dynamic res: " + DoubleToStr(Dynamic_Resist,4), 8, "Verdana", Black); } else { ObjectMove("ATR Dynamic Resist Label", 0, Time[LevelBarDisplay], Dynamic_Resist); } if(ObjectFind("ATR Dynamic Support Label") != 0) { ObjectCreate("ATR Dynamic Support Label", OBJ_TEXT, 0, Time[LevelBarDisplay], Dynamic_Support); ObjectSetText("ATR Dynamic Support Label", "ATR Dynamic sup: " + DoubleToStr(Dynamic_Support,4), 8, "Verdana", Black); } else { ObjectMove("ATR Dynamic Support Label", 0, Time[LevelBarDisplay], Dynamic_Support); } if(ObjectFind("Period Open Label") != 0) { ObjectCreate("Period Open Label", OBJ_TEXT, 0, Time[LevelBarDisplay], iOpen(0,TF,0)); ObjectSetText("Period Open Label", "Period Open: " + DoubleToStr(iOpen(0,TF,0),4), 8, "Verdana", Black); } else { ObjectMove("Period Open Label", 0, Time[LevelBarDisplay], iOpen(0,TF,0)); } return(0); } //+------------------------------------------------------------------+ double ATR(string Sym, int TimeFrame, int Per, int Shift, bool Sunday_FLG) { int i,j, Today_DOW,Yesterday_DOW; double h,l,c,tr,tr_sum=0; bool Sunday_Case; if (TimeFrame!=PERIOD_D1 || Sunday_FLG==false) return(iATR(Sym, TimeFrame, Per, Shift)); else for (i=0, j=0; i<Per; i++, j++) { while(iVolume(Sym,TimeFrame,Shift+j)<=MinVolume) j++; Today_DOW=TimeDayOfWeek(iTime(Sym,TimeFrame,Shift+j)); Yesterday_DOW=TimeDayOfWeek(iTime(Sym,TimeFrame,Shift+j+1)); if (Today_DOW==1 && Yesterday_DOW==0) { Sunday_Case=true; c=iClose(Sym,TimeFrame,Shift+j+2); h=MathMax(iHigh(Sym,TimeFrame,Shift+j),iHigh(Sym,TimeFrame,Shift+j+1)); l=MathMin(iLow(Sym,TimeFrame,Shift+j),iLow(Sym,TimeFrame,Shift+j+1)); } else { Sunday_Case=false; c=iClose(Sym,TimeFrame,Shift+j+1); h=iHigh(Sym,TimeFrame,Shift+j); l=iLow(Sym,TimeFrame,Shift+j); } if (c>h) tr=c-l; else if(c<l) tr=h-c; else tr=h-l; tr_sum=tr_sum+tr; // Ignore days with no volume if (Sunday_Case) j++; } return(tr_sum/Per); }

Forex Expert Advisor.

Avviso. I Forex Expert Advisor ed i mercati finanziari comportano rischi. Ti invitiamo a consultare il " Disclaimer " e la " Privacy "