Académique Documents
Professionnel Documents
Culture Documents
Indicator
This helpful indicator will show you the average daily range in pips for a currency pair and much
more! This is similar to the Weekly and Monthly Range calculator. The information provided
in this indicator can help in evaluating what position to place and where to put your stop loss at
for maximum effectiveness.
Features
Previous 1 day range (the number of previous days can be changed in settings)
Previous 5 day range
Room Up - How many pips the market could move up based on daily trading range and
current market price
Room Down - how many pips the market could move down based on daily trading range
and current market price
And it has a maximum stop loss level suggestion based on direction of price and what position
placed.
To incorporate this indicator into your trading platform, I have provided the code below:
For those that need instructions:
1.Open up MetaEditor through the MT4 terminal
2.Click on "File" ---> New
3.Choose Customer Indicator
4. Click "Next"
5. Put in desired indicator name
6. Click "Next"
7. Check box that says "Indicator in Seperate Window"
8. Click "Finish"
9. Delete the generic code
10.Copy the code below
11. Paste the code
12. Compile it to make sure it has not errors/warning
13. Should be zero errors/warning
14. Save
15. Restart MT4 terminal ---> You should now have your new indicator under the custom
indicator heading and able to attach it to any chart.
Code
#property indicator_separate_window
//---- input parameters
extern double Risk_to_Reward_ratio = 3.0;
extern int First_av = 5;
extern int Second_av = 10;
extern int Third_av = 20;
int nDigits;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorShortName("TSR");
if(Symbol()=="GBPJPY" || Symbol()=="EURJPY" || Symbol()=="USDJPY" ||
Symbol()=="CHFJPY" || Symbol()=="AUDJPY") nDigits = 2;
if(Symbol()=="GBPUSD" || Symbol()=="EURUSD" || Symbol()=="NZDUSD" ||
Symbol()=="USDCHF" ||
Symbol()=="USDCAD" || Symbol()=="AUDUSD" || Symbol()=="AUDCAD" ||
Symbol()=="EURCHF" || Symbol()=="EURGBP"
|| Symbol()=="EURCAD" || Symbol()=="EURAUD" ||Symbol()=="AUDNZD"||
Symbol()=="GBPCHF" )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<=First_av;i++)
R5 = R5 + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
for(i=1;i<=Second_av;i++)
R10 = R10 + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
for(i=1;i<=Third_av;i++)
R20 = R20 + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
R5 = R5/First_av;
R10 = R10/Second_av;
R20 = R20/Third_av;
RAvg = (R1+R5+R10+R20)/4; //RAvg = (R5+R10+R20)/3;new setting
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;
return(0);
}
//+------------------------------------------------------------------+
http://forexcashback.hubpages.com/hub/Average-Daily-Range-Indictor
This helpful indicator will show you the average weekly range in pips for a currency pair and is
similar to the Daily and Monthly range indicators. The information provided in this indicator
can help you in evaluating what position to place and where to put your stop loss at for
maximum effectiveness.
Features
Room Up - How many pips the market could move up based on weekly trading range and
current market price
Room Down - how many pips the market could move down based on weekly trading
range and current market price
And it has a maximum stop loss level suggestion based on direction of price and what position
placed.
To incorporate this indicator into your trading platform, I have provided the code below:
//+------------------------------------------------------------------+
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_W1,1)-iLow(NULL,PERIOD_W1,1))/Point;
for(i=1;i<=First_AV;i++)
R5 = R5 + (iHigh(NULL,PERIOD_W1,i)-iLow(NULL,PERIOD_W1,i))/Point;
for(i=1;i<=Second_AV;i++)
R10 = R10 + (iHigh(NULL,PERIOD_W1,i)-iLow(NULL,PERIOD_W1,i))/Point;
for(i=1;i<=Third_AV;i++)
R20 = R20 + (iHigh(NULL,PERIOD_W1,i)-iLow(NULL,PERIOD_W1,i))/Point;
R5 = R5/First_AV;
R10 = R10/Second_AV;
R20 = R20/Third_AV;
RAvg = (R1+R5+R10+R20)/4; //RAvg = (R5+R10+R20)/3;new setting
low0 = iLow(NULL,PERIOD_W1,0);
high0 = iHigh(NULL,PERIOD_W1,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 Weeks Range: " + RAvg + "\n" +
"Prev 01 Weeks Range: " + R1 + "\n" +
return(0);
}
//+------------------------------------------------------------------+
http://forexcashback.hubpages.com/hub/Average-Weekly-Range-Calculator-Custome-MT4Indicator
This helpful indicator will show you the average monthly range in pips for a currency pair and is
similar to the Daily and Weekly range indicators. The information provided in this indicator can
help you in evaluating what position to place and where to put your stop loss at for maximum
effectiveness.
Features
Room Up - How many pips the market could move up based on monthly trading range
and current market price
Room Down - how many pips the market could move down based on monthly trading
range and current market price
And it has a maximum stop loss level suggestion based on direction of price and what position
placed.
To incorporate this indicator into your trading platform, I have provided the code below:
Code:
#property indicator_separate_window
//---- input parameters
extern double Risk_to_Reward_ratio = 3.0;
extern int First_Av = 5;
extern int Second_Av = 10;
extern int Third_Av = 20;
int nDigits;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorShortName("TSR_Monthly");
if(Symbol()=="GBPJPY" || Symbol()=="EURJPY" || Symbol()=="USDJPY" ||
Symbol()=="CHFJPY" || Symbol()=="AUDJPY") nDigits = 2;
if(Symbol()=="GBPUSD" || Symbol()=="EURUSD" || Symbol()=="NZDUSD" ||
Symbol()=="USDCHF" ||
Symbol()=="USDCAD" || Symbol()=="AUDUSD" || Symbol()=="AUDCAD" ||
Symbol()=="EURCHF" || Symbol()=="EURGBP"
|| Symbol()=="EURCAD" || Symbol()=="EURAUD" ||Symbol()=="AUDNZD"||
Symbol()=="GBPCHF" )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_MN1,1)-iLow(NULL,PERIOD_MN1,1))/Point;
for(i=1;i<=First_Av;i++)
R5 = R5 + (iHigh(NULL,PERIOD_MN1,i)-iLow(NULL,PERIOD_MN1,i))/Point;
for(i=1;i<=Second_Av;i++)
R10 = R10 + (iHigh(NULL,PERIOD_MN1,i)-iLow(NULL,PERIOD_MN1,i))/Point;
for(i=1;i<=Third_Av;i++)
R20 = R20 + (iHigh(NULL,PERIOD_MN1,i)-iLow(NULL,PERIOD_MN1,i))/Point;
R5 = R5/First_Av;
R10 = R10/Second_Av;
R20 = R20/Third_Av;
RAvg = (R1+R5+R10+R20)/4; //RAvg = (R5+R10+R20)/3;new setting
low0 = iLow(NULL,PERIOD_MN1,0);
high0 = iHigh(NULL,PERIOD_MN1,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;
return(0);
}
//+------------------------------------------------------------------+
http://forexcashback.hubpages.com/hub/Average-Monthly-Range-Calculator-MT4-CustomIndicator