# Experts: Currency Strength EA - page 5

1644

Ahmed Tawfik:

I guess this is the correct formula Not the Previous one

Have you corrected the formula calc on the published source code yet?
1644

What's the proper arithmetic here?

```//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>|

double eur = (EURJPY + EURCAD + EURGBP + EURCHF + EURAUD + EURUSD + EURNZD) / 7;
double usd = (USDJPY + USDCAD - AUDUSD + USDCHF - GBPUSD - EURUSD - NZDUSD) / 7;
double jpy = (-1 * (USDJPY + EURJPY + AUDJPY + CHFJPY + GBPJPY + CADJPY + NZDJPY) ) / 7;
double aud = (AUDUSD + AUDNZD + AUDCAD + AUDCHF + AUDJPY - (EURAUD + GBPAUD) ) / 7;
double nzd = (NZDUSD + NZDJPY - (EURNZD + AUDNZD + GBPNZD) ) / 5;
double gbp = (GBPUSD - EURGBP + GBPCHF + GBPAUD + GBPCAD + GBPJPY + GBPNZD) / 7;
double chf = (CHFJPY - (USDCHF + EURCHF + AUDCHF + GBPCHF + CADCHF) ) / 6;
/*
double eur = (EURJPY + EURCAD + EURGBP + EURCHF + EURAUD + EURUSD + EURNZD) / 7;
double usd = (USDJPY + USDCAD + USDCHF - (1 / (EURUSD + NZDUSD + AUDUSD + GBPUSD))) / 7;
double jpy = (-1 / (USDJPY + EURJPY + AUDJPY + CHFJPY + GBPJPY + CADJPY + NZDJPY)) / 7;
double aud = (AUDUSD + AUDNZD + AUDCAD + AUDCHF + AUDJPY - (1 / (EURAUD + GBPAUD))) / 7;
double nzd = (NZDUSD + NZDJPY - (1 / (EURNZD + AUDNZD + GBPNZD))) / 5;
double gbp = (GBPUSD + GBPCHF + GBPAUD + GBPCAD + GBPJPY + GBPNZD - (1 / (EURGBP))) / 7;
double chf = (CHFJPY - (1 / (USDCHF + EURCHF + AUDCHF + GBPCHF + CADCHF))) / 6;
*/
/*
double eur = (EURJPY + EURCAD + EURGBP + EURCHF + EURAUD + EURUSD + EURNZD) / 7;
double usd = (USDJPY + USDCAD + USDCHF + (1 / (EURUSD + NZDUSD + AUDUSD + GBPUSD))) / 7;
double jpy = (1 / (USDJPY + EURJPY + AUDJPY + CHFJPY + GBPJPY + CADJPY + NZDJPY)) / 7;
double aud = (AUDUSD + AUDNZD + AUDCAD + AUDCHF + AUDJPY + (1 / (EURAUD + GBPAUD))) / 7;
double nzd = (NZDUSD + NZDJPY +(1 / (EURNZD + AUDNZD + GBPNZD))) / 5;
double gbp = (GBPUSD + GBPCHF + GBPAUD + GBPCAD + GBPJPY + GBPNZD + (1 / (EURGBP))) / 7;
double chf = (CHFJPY + (1 / (USDCHF + EURCHF + AUDCHF + GBPCHF + CADCHF))) / 6;
*/
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>|
```
163

Edward Salas:

What's the proper arithmetic here?

This arithmetic causes false positives, because the decision to BUY or SELL is based on it.

We cannot use those average values this way.

4

Hello Jaspreet and friends. I want to thank you for your contribution of this EA. I have taken the liberty of modifying the code to place a Stop Loss for each order now. I have also tried to implement a Trailing Stop function but I cannot get it to work, so I have Remmed it out as well as other items that I had been playing around with. I have also tried to add a "Close Order" function to close any order in case the signal for that particular pair changed direction, but I don't know if that is working correctly. Everyone please forgive me as I am not a very strong coder, I am simply trying to help develop this EA because I feel that is has a great potential to be a very good EA. I have labeled it version 4.9

//+------------------------------------------------------------------+
//|                                     Currency Strength v4.9.mq4 |
//|                                                           Author: Jay_P |
//|                                                               25-Jan-2017 |
//|                                     Modded by AG2012 03/10/19|
//+------------------------------------------------------------------+
#property copyright "Currency Strength EA by Jay_P, modified by AG2012"

//--- input parameters
extern int  TakeProfit= 150; // Take Profit (in Pips)
extern int  StopLoss = 400; // Stop Loss (in pips)
extern int Slippage = 3;
//extern bool TF = PERIOD_H4;
//extern bool UseTrailing = true;
//extern int  TrailingStop = 20; // Trailing Stop (in pips)
//extern int  MinPipsToTrail = 5; // Trailing Distance (in pips)
extern bool UseOrderClose = true;
extern string prefix="";
extern string postfix="";
extern double diff_val = 0.65; // Difference Between Two Currencies Percentage
string calc_per = PERIOD_D1;
int Magic=1284; // Magic Number
int Magic2=1294;
double signal;
//string rsi;
//double rsi = iRSI(Symbol(),PERIOD_H1, 2, PRICE_CLOSE, 0);
//double Magic;
//string sym;
//bool symbol;

/*void TrailingStop() {
string sym=OrderSymbol();
for (int l_pos_0 = 0; l_pos_0 <= OrdersTotal(); l_pos_0++) {
if (OrderMagicNumber() == Magic) {
if ((MarketInfo(sym, MODE_BID) - OrderOpenPrice()) / MarketInfo(sym, MODE_POINT) >= MinPipsToTrail && OrderStopLoss() < MarketInfo(sym, MODE_BID) - TrailingStop * MarketInfo(sym, MODE_POINT)) OrderModify(OrderTicket(), OrderOpenPrice(), MarketInfo(sym, MODE_BID) - TrailingStop * MarketInfo(sym, MODE_POINT), OrderTakeProfit(), 0, Blue);
else if (OrderMagicNumber() == Magic2)
if (OrderType() == OP_SELL) {
if ((OrderOpenPrice() - MarketInfo(sym, MODE_ASK)) / MarketInfo(sym, MODE_POINT) >= MinPipsToTrail && OrderStopLoss() > MarketInfo(sym, MODE_ASK) +
TrailingStop * MarketInfo(sym, MODE_POINT)) OrderModify(OrderTicket(), OrderOpenPrice(), MarketInfo(sym, MODE_ASK) + TrailingStop * MarketInfo(sym, MODE_POINT), OrderTakeProfit(), 0, Red);
}
}
}
}*/

//+------------------------------------------------------------------+
//|                                                                                   |
//+------------------------------------------------------------------+
int start()
{

double USDJPY = perch(prefix+"USDJPY"+postfix);
double AUDUSD = perch(prefix+"AUDUSD"+postfix);
double USDCHF = perch(prefix+"USDCHF"+postfix);
double GBPUSD = perch(prefix+"GBPUSD"+postfix);
double EURUSD = perch(prefix+"EURUSD"+postfix);
double NZDUSD = perch(prefix+"NZDUSD"+postfix);
double EURJPY = perch(prefix+"EURJPY"+postfix);
double EURGBP = perch(prefix+"EURGBP"+postfix);
double EURCHF = perch(prefix+"EURCHF"+postfix);
double EURAUD = perch(prefix+"EURAUD"+postfix);
double EURNZD = perch(prefix+"EURNZD"+postfix);
double AUDNZD = perch(prefix+"AUDNZD"+postfix);
double AUDCHF = perch(prefix+"AUDCHF"+postfix);
double AUDJPY = perch(prefix+"AUDJPY"+postfix);
double CHFJPY = perch(prefix+"CHFJPY"+postfix);
double GBPCHF = perch(prefix+"GBPCHF"+postfix);
double GBPAUD = perch(prefix+"GBPAUD"+postfix);
double GBPJPY = perch(prefix+"GBPJPY"+postfix);
double NZDJPY = perch(prefix+"NZDJPY"+postfix);
double GBPNZD = perch(prefix+"GBPNZD"+postfix);

double nzd = (NZDUSD+NZDJPY-(EURNZD+AUDNZD+GBPNZD))/5;

eur = NormalizeDouble(eur,2);
usd = NormalizeDouble(usd,2);
jpy = NormalizeDouble(jpy,2);
aud = NormalizeDouble(aud,2);
nzd = NormalizeDouble(nzd,2);
gbp = NormalizeDouble(gbp,2);
chf = NormalizeDouble(chf,2);

//---------------------------------------------------------

Comment (
"\n"
"-----------------------------------------------------\n"
"ACCOUNT INFORMATION:\n"
"This Broker Is : " + AccountCompany()+ "\n"
"Account Name:     " + AccountName()+ "\n"
"Account Leverage:     " + DoubleToStr(AccountLeverage(), 0)+ "\n"
"Account Balance:     " + DoubleToStr(AccountBalance(), 2)+ "\n"
"Account Equity:     " + DoubleToStr(AccountEquity(), 2)+ "\n"
"Free Margin:     " + DoubleToStr(AccountFreeMargin(), 2)+ "\n"
"Used Margin:     " + DoubleToStr(AccountMargin(), 2)+ "\n"
"Account Profit:     " + DoubleToStr(AccountProfit(), 2)+ "\n"
"-----------------------------------------------------\n"
"\n"
"\n"

//double MA1  = iMA(NULL, NULL, 3, 0, MODE_EMA, PRICE_TYPICAL, 0);
//double MA2  = iMA(NULL, NULL, 5, 0, MODE_EMA, PRICE_TYPICAL, 0);
//double Mickey_D  = iMACD(NULL, NULL, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);
//double l_istoch_400 = iStochastic(NULL, NULL,5,3,3, MODE_EMA, 0, MODE_MAIN, 0);
//double l_istoch_401 = iStochastic(NULL, NULL,14,3,3, MODE_EMA, 0, MODE_MAIN, 0);
//double rsi = iRSI(NULL,PERIOD_D1, 2, PRICE_CLOSE, 0);
//double rsi;
//double Gann = iCustom(NULL, NULL, "Gann_SQ9_A6",22.5,22.5,0,2,32,Tomato,DodgerBlue,LightSteelBlue,true,1,0);
//double l_istoch_400;
//double l_istoch_401;
//double l_istoch_400 = iStochastic(perch(Symbol()), NULL,5,3,3, MODE_EMA, 0, MODE_MAIN, 0);
//double l_istoch_401 = iStochastic(perch(Symbol()), NULL,14,3,3, MODE_EMA, 0, MODE_MAIN, 0);
//double op;
//double hi;
//double lo;
//double MA1;
//double MA2;

if(MathAbs(usd-jpy) > diff_val)
{
if (usd > 0 && jpy < 0)
//if (usd > 0)

{
}
else if (usd < 0 && jpy > 0)
//else if (usd < 0)

{
}
}

{
if (usd > 0 && cad < 0)
//if (usd > 0)

{
}
else if (usd < 0 && cad > 0)
//else if (usd < 0)

{
}
}

if(MathAbs(aud-usd)> diff_val)
{
if (aud > 0 && usd < 0)
//if (aud > 0)

{
}
else if (aud < 0 && usd > 0)
//else if (aud < 0)
{
}
}

if(MathAbs(usd-chf)>diff_val)
{
if (usd > 0 && chf < 0)
//if (usd > 0)

{
}
else if (usd < 0 && chf > 0)
//else if (usd < 0)

{
}
}

if(MathAbs(gbp-usd)>diff_val)
{
if (gbp > 0 && usd < 0)
//if (gbp > 0)

{
}
else if (gbp < 0 && usd > 0)
//else if (gbp < 0)

{
}
}

if(MathAbs(eur-usd)>diff_val)
{
if (eur > 0 && usd < 0)
//if (eur > 0)

{
}
else if (eur < 0 && usd > 0)
//else if (eur < 0)

{
}
}

if(MathAbs(nzd-usd)>diff_val)
{
if (nzd > 0 && usd < 0)
//if (nzd > 0)

{
}
else if (nzd < 0 && usd > 0)
//else if (nzd < 0)

{
}
}

if(MathAbs(eur-jpy)>diff_val)
{
if (eur > 0 && jpy < 0)
//if (eur > 0)

{
}
else if (eur < 0 && jpy > 0)
//else if (eur < 0)

{
}
}

{
if (eur > 0 && cad < 0)
//if (eur > 0)

{
}
else if (eur < 0 && cad > 0)
//else if (eur < 0)

{
}
}

if(MathAbs(eur-gbp)>diff_val)
{
if (eur > 0 && gbp < 0)
//if (eur > 0)

{
}
else if (eur < 0 && gbp > 0)
//else if (eur < 0)

{
}
}

if(MathAbs(eur-chf)>diff_val)
{
if (eur > 0 && chf < 0)
//if (eur > 0)

{
}
else if (eur < 0 && chf > 0)
//else if (eur < 0)

{
}
}

if(MathAbs(eur-aud)>diff_val)
{
if (eur > 0 && aud < 0)
//if (eur > 0)

{
}
else if (eur < 0 && aud > 0)
//else if (eur < 0)

{
}
}

if(MathAbs(eur-nzd)>diff_val)
{
if (eur > 0 && nzd < 0)
//if (eur > 0)

{
}
else if (eur < 0 && nzd > 0)
//else if (eur < 0)

{
}
}

if(MathAbs(aud-nzd)>diff_val)
{
if (aud > 0 && nzd < 0)
//if (aud > 0)

{
}
else if (aud < 0 && nzd > 0)
//else if (aud < 0)

{
}
}

{
if (aud > 0 && cad < 0)
//if (aud > 0)

{
}
else if (aud < 0 && cad > 0)
//else if (aud < 0)

{
}
}

if(MathAbs(aud-chf)>diff_val)
{
if (aud > 0 && chf < 0)
//if (aud > 0)

{
}
else if (aud < 0 && chf > 0)
//else if (aud < 0)

{
}
}

if(MathAbs(aud-jpy)>diff_val)
{
if (aud > 0 && jpy < 0)
//if (aud > 0)

{
}
else if (aud < 0 && jpy > 0)
//else if (aud < 0)

{
}
}

if(MathAbs(chf-jpy)>diff_val)
{
if (chf > 0 && jpy < 0)
//if (chf > 0)

{
}
else if (chf < 0 && jpy > 0)
//else if (chf < 0)

{
}
}

if(MathAbs(gbp-chf)>diff_val)
{
if (gbp > 0 && chf < 0)
//if (gbp > 0)

{
}
else if (gbp < 0 && chf > 0)
//else if (gbp < 0)

{
}
}

if(MathAbs(gbp-aud)>diff_val)
{
if (gbp > 0 && aud < 0)
//if (gbp > 0)

{
}
else if (gbp < 0 && aud > 0)
//else if (gbp < 0)

{
}
}

{
if (gbp > 0 && cad < 0)
//if (gbp > 0)

{
}
else if (gbp < 0 && cad > 0)
//else if (gbp < 0)

{
}
}

if(MathAbs(gbp-jpy)>diff_val)
{
if (gbp > 0 && jpy < 0)
//if (gbp > 0)

{
}
else if (gbp < 0 && jpy > 0)
//else if (gbp < 0)

{
}
}

{
if (cad > 0 && jpy < 0)

{
}
else if (cad < 0 && jpy > 0)

{
}
}

if(MathAbs(nzd-jpy)>diff_val)
{
if (nzd > 0 && jpy < 0)
//if (nzd > 0)
{
}
else if (nzd < 0 && jpy > 0)
//else if (nzd < 0)

{
}
}

if(MathAbs(gbp-nzd)>diff_val)
{
//if(MathAbs(gbp<nzd))
if (gbp > 0 && nzd < 0)
//if (gbp > 0)

{
}
else if (gbp < 0 && nzd > 0)
//else if (gbp < 0)
{
}
}

{
if (cad > 0 && chf < 0)

{
}
else if (cad < 0 && chf > 0)

{
}
}
return(0);

}

//+------------------------------------------------------------------+
//|            CALCULATING PERCENTAGE Of SYMBOLS        |
//+------------------------------------------------------------------+

/*double MA1  = iMA(Symbol(), NULL, 3, 0, MODE_EMA, PRICE_TYPICAL, 0);
double MA2  = iMA(Symbol(), NULL, 5, 0, MODE_EMA, PRICE_TYPICAL, 0);
double Mickey_D  = iMACD(Symbol(), 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);*/
//double l_istoch_400;
//double l_istoch_401;

double perch(string sym)

{
//double per = (MarketInfo(sym, MODE_HIGH) - MarketInfo(sym, MODE_LOW)) * MarketInfo(sym, MODE_POINT);
//double per = 100.0 * ((MarketInfo(sym, MODE_BID) - MarketInfo(sym, MODE_ASK)) / per * MarketInfo(sym, MODE_POINT));
double op = iOpen(sym,calc_per,0);
double cl = iClose(sym,calc_per,0);
//double l_istoch_400 = iStochastic(sym, NULL,5,3,3, MODE_EMA, 0, MODE_MAIN, 0);
//double l_istoch_401 = iStochastic(sym, NULL,14,3,3, MODE_EMA, 0, MODE_MAIN, 0);
//double rsi = iRSI(sym,PERIOD_H1, 2, PRICE_CLOSE, 0);
//double op = iOpen(sym,PERIOD_D1,0);
//double hi = iHigh(sym,PERIOD_D1,0);
//double lo = iLow(sym,PERIOD_D1,0);
//double MA1  = iMA(NULL, NULL, 3, 0, MODE_EMA, PRICE_TYPICAL, 0);
//double MA2  = iMA(NULL, NULL, 5, 0, MODE_EMA, PRICE_TYPICAL, 0);
//per = 100.0 * ((MarketInfo(sym, MODE_BID) - MarketInfo(sym, MODE_LOW)) * MarketInfo(sym, MODE_POINT));
double per=(cl-op)/op*1000;
if (per == 0) return(0);
if (per !=0)
//per = 100.0 * ((MarketInfo(sym, MODE_BID) - MarketInfo(sym, MODE_ASK)) / per * MarketInfo(sym, MODE_POINT));
//per = 100.0 * ((MarketInfo(sym, MODE_BID) - MarketInfo(sym, MODE_LOW)) / per * MarketInfo(sym, MODE_POINT));
per=NormalizeDouble(per,2);
return(per);
//double Sym = sym;
//return(Sym);

}

//+------------------------------------------------------------------+
//|                                                                                   |
//+------------------------------------------------------------------+

double Sym;
double sym = Sym;
//double perch = Sym;
double rsi = iRSI(Sym,calc_per, 2, PRICE_CLOSE, 0);
void ClosePositions() {

for (int l_pos_0 = 0; l_pos_0 <= OrdersTotal(); l_pos_0++) {
if (UseOrderClose)
if (signal=="Sell" && OrderMagicNumber() == Magic) {
if (OrderType() == OP_BUY) SafeOrderClose(OrderTicket(), OrderLots(), MarketInfo(Sym, MODE_BID), Slippage, Green);
//if (Obos > OBThreshold && OrderType() == OP_BUY) SafeOrderClose(OrderTicket(), OrderLots(), MarketInfo(g_str_concat_212, MODE_BID), Slippage, Green);
else if (signal=="Buy" && OrderMagicNumber() == Magic2)
if (OrderType() == OP_SELL) SafeOrderClose(OrderTicket(), OrderLots(), MarketInfo(Sym, MODE_ASK), Slippage, Orange);
//if (Obos < OSThreshold && OrderType() == OP_SELL) SafeOrderClose(OrderTicket(), OrderLots(), MarketInfo(g_str_concat_212, MODE_ASK), Slippage, Salmon);
}
}
}

int SafeOrderClose(int a_ticket_0, double a_lots_4, double a_price_12, int a_slippage_20, color a_color_24 = -1) {
int l_error_28 = 146;
bool l_ord_close_32 = FALSE;
for (int l_count_36 = 0; l_count_36 < 2 && l_ord_close_32 == 0; l_count_36++) {
while (l_error_28 == 146/* TRADE_CONTEXT_BUSY */ && l_ord_close_32 == 0) {
WaitForContext();
if (OrderType() == OP_BUY) l_ord_close_32 = OrderClose(a_ticket_0, a_lots_4, a_price_12, a_slippage_20, a_color_24);
l_error_28 = GetLastError();
if (OrderType() == OP_SELL) l_ord_close_32 = OrderClose(a_ticket_0, a_lots_4, a_price_12, a_slippage_20, a_color_24);
l_error_28 = GetLastError();
}
}
return (l_ord_close_32);
}

void WaitForContext() {
Sleep(1);
RefreshRates();
}
RefreshRates();
}

{
int count,count2=0;
//int count=0;
for(int pos=0; pos<=OrdersTotal(); pos++)
{
if(OrderSelect(pos,SELECT_BY_POS)
&& OrderMagicNumber()==Magic       //When Magic number is correct
&& OrderSymbol()==sym) // Only When Its of Chart Symbol
{              // and my pair.
count++; // Count the number of Positions in Order List Of Chart Symbol
} //if ended

else if(OrderSelect(pos,SELECT_BY_POS)
&& OrderMagicNumber()==Magic2
&& OrderSymbol()==sym)
{              // and my pair.
count2++; // Count the number of Positions in Order List Of Chart Symbol
//if ended
}//for ended
}

double bid = MarketInfo(sym,MODE_BID);
double point=MarketInfo(sym,MODE_POINT);
double digits=MarketInfo(sym,MODE_DIGITS);

//double per= (MarketInfo(sym, MODE_HIGH) - MarketInfo(sym, MODE_LOW)) * MarketInfo(sym, MODE_POINT);

double op = iOpen(sym,PERIOD_H1,0);
double cl = iClose(sym,PERIOD_H1,0);
//double rsi = iRSI(sym,PERIOD_H1, 2, PRICE_CLOSE, 0);
double sto1 = iStochastic(sym, PERIOD_H1,5,3,3, MODE_EMA, 0, MODE_MAIN, 0);
double sto2 = iStochastic(sym, PERIOD_H1,14,3,3, MODE_EMA, 0, MODE_MAIN, 0);

int    Cur_Hour=Hour();             // Server time in hours
double Cur_Min =Minute();           // Server time in minutes
double Cur_time=Cur_Hour+(Cur_Min)/100; // Current time

int TodaySeconds=(Hour()*3600)+(Minute()*60)+Seconds();
int YesterdayEnd=TimeCurrent()-TodaySeconds;
int YesterdayStart=YesterdayEnd-86400;

{
for(int h=OrdersHistoryTotal()-1;h>=0;h--) // Trade Once per Pair
{
if(OrderSelect(h,SELECT_BY_POS,MODE_HISTORY)==true) // select next
{
if(OrderCloseTime()>YesterdayEnd && OrderSymbol()==sym && OrderMagicNumber()==Magic)
{
}

else if(OrderCloseTime()>YesterdayEnd && OrderSymbol()==sym && OrderMagicNumber()==Magic2)
{
}
}
}
}

{
if(signal=="Buy" /*&& rsi>71 && sto1>80 && sto2>80*/)
{
TakeProfit * MarketInfo(sym, MODE_POINT), "Buy", Magic, 0, Blue);
}
}

{
if(signal=="Sell" /*&& rsi<29 && sto1<20 && sto2<20*/)
{
OrderSend(sym, OP_SELL, TradingLots, MarketInfo(sym, MODE_BID), 0, MarketInfo(sym, MODE_BID) + StopLoss * MarketInfo(sym, MODE_POINT), MarketInfo(sym, MODE_BID) - TakeProfit * MarketInfo(sym, MODE_POINT), "Sell", Magic2, 0, Red);
//OrderSend(sym, OP_SELL, TradingLots, MarketInfo(sym, MODE_BID), 0, MarketInfo(sym, MODE_BID) + StopLoss * MarketInfo(sym, MODE_POINT), MarketInfo(sym, MODE_BID) - TakeProfit * MarketInfo(sym, MODE_POINT), "Sell", Magic, 0, Red);
}

}// If Ended

if(OrdersTotal()>0)
{
for(int i=1; i<=OrdersTotal(); i++) // Cycle searching in orders
{
if(OrderSelect(i-1,SELECT_BY_POS)==true && OrderSymbol()==sym)
{
double tpb=NormalizeDouble(OrderOpenPrice()+TakeProfit*point*10,digits);
double slb=NormalizeDouble(OrderOpenPrice()-StopLoss*point*10,digits);
double tps=NormalizeDouble(OrderOpenPrice()-TakeProfit*point*10,digits);
double sls=NormalizeDouble(OrderOpenPrice()+StopLoss*point*10,digits);

if(OrderMagicNumber()==Magic && OrderType()==OP_BUY && OrderTakeProfit()==0 && OrderSymbol()==sym)
{
OrderModify(OrderTicket(),0,0,tpb,0,CLR_NONE);
OrderModify(OrderTicket(),0,0,slb,0,CLR_NONE);
}

else if(OrderMagicNumber()==Magic2 && OrderType()==OP_SELL && OrderTakeProfit()==0 && OrderSymbol()==sym)
//else if(OrderMagicNumber()==Magic && OrderType()==OP_SELL && OrderTakeProfit()==0 && OrderSymbol()==sym)
{
OrderModify(OrderTicket(),0,0,tps,0,CLR_NONE);
OrderModify(OrderTicket(),0,0,sls,0,CLR_NONE);
Alert(sym+" TP-Sell: "+tps, sym+" SL-Sell: "+sls);
}
return(0);

}//Nested-if Ended
}//for loop ended
}//if Ended
}

129

The batch setting is only based on the capital in your account, you have a batch file size where you can get your expiration from there!

Files: