How are you? BarrowBoy

To add comments, please log in or register
shams
45
shams  
Hi BarrowBoy,
How are you?
Need your help again!..Can you write this EA for me...
Thanks in advance.
My question is :
1) How to open order for 2 currency pair like E/G and U/J at same time(hedge) in only using E/G H1 chart? example: E/G=buy, U/J=sell using the WPR as below:
//+------------------------------------------------------------------+
//| Williams?Percent Range.mq4 |
//| Copyright ?2005, MetaQuotes Software Corp. |
//| https://www.metaquotes.net// |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net//"
//----
#property indicator_separate_window
#property indicator_minimum -100
#property indicator_maximum 0
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
#property indicator_level1 -20
#property indicator_level2 -80
//---- input parameters
extern int ExtWPRPeriod = 14;
//---- buffers
double ExtWPRBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string sShortName;
//---- indicator buffer mapping
SetIndexBuffer(0, ExtWPRBuffer);
//---- indicator line
SetIndexStyle(0, DRAW_LINE);
//---- name for DataWindow and indicator subwindow label
sShortName="%R(" + ExtWPRPeriod + ")";
IndicatorShortName(sShortName);
SetIndexLabel(0, sShortName);
//---- first values aren't drawn
SetIndexDrawBegin(0, ExtWPRPeriod);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Williams?Percent Range |
//+------------------------------------------------------------------+
int start()
{
int i, nLimit, nCountedBars;
//---- insufficient data
if(Bars <= ExtWPRPeriod)
return(0);
//---- bars count that does not changed after last indicator launch.
nCountedBars = IndicatorCounted();
//----Williams?Percent Range calculation
i = Bars - ExtWPRPeriod - 1;
if(nCountedBars > ExtWPRPeriod)
i = Bars - nCountedBars - 1;
while(i >= 0)
{
double dMaxHigh = High[Highest(NULL, 0, MODE_HIGH, ExtWPRPeriod, i)];
double dMinLow = Low[Lowest(NULL, 0, MODE_LOW, ExtWPRPeriod, i)];
if(!CompareDouble((dMaxHigh - dMinLow), 0.0))
ExtWPRBuffer[i] = -100*(dMaxHigh - Close[i]) / (dMaxHigh - dMinLow);
i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| 泽黻鲨 耩囗屙? 溻篚 忮耱忮眄 麒皴? |
//+------------------------------------------------------------------+
bool CompareDouble(double Number1, double Number2)
{
bool Compare = NormalizeDouble(Number1 - Number2, 8) == 0;
return(Compare);
}
//+------------------------------------------------------------------+
Geolynx Saemane
9
Geolynx Saemane  

Hi BarrowBoy

Just a question

Why do we have to use OrderTakeProfit() in OrderModify rather than just setting own declared normalized Take Profit value

OrderModify(OrderTicket(), OrderOpenPrice(), Bid - TSTP, OrderTakeProfit(), Red)

Have searching in the forum for any answer to this question without luck

Sergey Golubev
Moderator
114323
Sergey Golubev  
shams:
...

Forum on trading, automated trading systems and testing trading strategies

When you post code please use the CODE button (Alt-S)!

Use the CODE button

Thank you.

William Roeder
20228
William Roeder  
Geolynx Saemane: Why do we have to use OrderTakeProfit() in OrderModify rather than just setting own declared normalized Take Profit value
OrderModify(OrderTicket(), OrderOpenPrice(), Bid - TSTP, OrderTakeProfit(), Red)
  1. You don't. It's just convenient to use. Rather than remember all existing values, the above line of code is only modifying the SL and keeping the rest the same.
  2. The above line is bogus, it's missing expiration.
To add comments, please log in or register