You didn't post a topic yet. Let us show you how to make your first topic and upload your favorite forex robot. Guide me

Skip to forum content

Quick Login / Register with Facebook Account!

Login with Facebook

Login with Username and Password!

     Username:       Password:  Login

Register  |  Forgot Password?

 

The latest topics with attached files (Forex robots, Forex Indicators, etc..)

Forums in this category with details of Replies, Views, last post

EURUSD RFX- 1MIN

by ftoncu.bim

FOREX EA

by rossolebile

My forex ea

by pilililo2

SWB stealth v1.01 EA

by Zahid Frx

Hide

Highest Forex Leverage 1:3000!

Try your Forex Robot with with the highest leverage 1:3000!

All Forex robot strategies allowed! Scalping, hedging, martingale, etc...



Search options (Page 11 of 310)

Profit → ► MT4talk - FREE Forex Robots and more... → Search results

Pages Previous 1 9 10 11 12 13 310 Next

Perform new search

Posts found: 101 to 110 of 3,096

We tested this EA.
- Broker Insta Forex  instaforex.com/fast_open_live_account?x=LIXU
- $20,000 deposit
- leverage 1:1000
- starting Lot size 0.01
- 30% drawdown
- total profit over $15,000
- trade period month.

I think this setting is very safe now.

Try it and let me know.

https://mt4talk.com/img/m/2/5b89296b68bd68.16099592.gif

Guys, here is a new test. 1 month trade.

https://mt4talk.com/img/m/2/5b8927b6abc944.85078877.gif
- TimeFrame: H1
- $20,000 deposit
- leverage 1:1000
- 30% drawdown
- total profit over $15,000
- trade period 1 moth.

This setting is very safe now.

Try it and let me know.

mdnazri.shamsudin wrote:

Hmm what happened to my previous post? Guess it got deleted.

Anyway I topped up another $20k to my demo account that was blown previously after 24 hours to test but with lot size 0.20. It made $10k after 32 hours because of a 9 level martingale (last lot size opened was 51.20). It is still risky. One more level and it might wipe out my account again. It had around 45% DD at one point and then it went up in favour and barely hit TP and closed all the trades to make the $10k profit before it went down again, this time even lower which would definitely wipe out my account again.

Guess I should use an even smaller lot size like 0.10. And I wonder why OP recommended a lot size of 1.0 for a $20k account lol. It is definitely not workable.

1.0 lot size with a $20,000 is a risky setting. Works many times but is risky. You should use much smaller size.

Keep up the testing and post your experience about this EA smile

Hmm what happened to my previous post? Guess it got deleted.

Anyway I topped up another $20k to my demo account that was blown previously after 24 hours to test but with lot size 0.20. It made $10k after 32 hours because of a 9 level martingale (last lot size opened was 51.20). It is still risky. One more level and it might wipe out my account again. It had around 45% DD at one point and then it went up in favour and barely hit TP and closed all the trades to make the $10k profit before it went down again, this time even lower which would definitely wipe out my account again.

Guess I should use an even smaller lot size like 0.10. And I wonder why OP recommended a lot size of 1.0 for a $20k account lol. It is definitely not workable.

crosszone13 wrote:

You can use Auto MM=2% (low risk) up to 10% (high risk), according to the significance of your account and your risk and profit expectations.

Reasonable fixed Lot size is 0.05 on 1k account balance, or 0.5 lots on 10k account balance.

If you use multiple currency pairs, you should consider decreasing the risk accordingly.

Supported currency pairs: GBPUSD, EURUSD, USDCHF

The default settings are for GBPUSD. The robot can be used on other currency pairs, too. For other supported pairs and .set files, please check here.

You can run the EA on M1 or M15 chart – it makes no difference for the EA, as all used timeframes are hardcoded.

You can backtest and optimize the EA on M1 chart by “open price only” method – this will be correct enough and save you a lot of time.

Finally, please, bear in mind that Holy Grails in trading does not exist! Even the best system suffers some bad periods. BF Smart Scalp EA is using very reasonable SL levels, so they can get hit /even repeatedly/ in bad market condition. Please, do not leave negative comments after every SL hit, or losing trade!






Thank you very much for the robot and especially for the instructions given. Thank you.
You said: "For other supported .set pairs and files, please check here" and the link does not work. Can you send us .set files for other pairs? thank you in advance

You can use Auto MM=2% (low risk) up to 10% (high risk), according to the significance of your account and your risk and profit expectations.

Reasonable fixed Lot size is 0.05 on 1k account balance, or 0.5 lots on 10k account balance.

If you use multiple currency pairs, you should consider decreasing the risk accordingly.

Supported currency pairs: GBPUSD, EURUSD, USDCHF

The default settings are for GBPUSD. The robot can be used on other currency pairs, too. For other supported pairs and .set files, please check here.

You can run the EA on M1 or M15 chart – it makes no difference for the EA, as all used timeframes are hardcoded.

You can backtest and optimize the EA on M1 chart by “open price only” method – this will be correct enough and save you a lot of time.

Finally, please, bear in mind that Holy Grails in trading does not exist! Even the best system suffers some bad periods. BF Smart Scalp EA is using very reasonable SL levels, so they can get hit /even repeatedly/ in bad market condition. Please, do not leave negative comments after every SL hit, or losing trade!

gordontan wrote:

good and sharp ,close only with profits and never with losses

//+------------------------------------------------------------------+
//                        DO NOT DELETE THIS HEADER
//             DELETING THIS HEADER IS COPYRIGHT INFRIGMENT 
//
//                   Copyright ©2017, https://mt4talk.com
//                     MT4talk Expert Advisor Generator
//                        https://mt4talk.com/eagenerator/
//
// THIS EXPERT ADVISOR (EA) HAS BEEN GENERATED USING MT4talk EA GENERATOR. 
// 
// Disclaimer: This EA is provided to you "AS-IS", and MT4talk disclaims any warranty
// or liability obligations to you of any kind. 
//
// FREE EA LICENSE
// This EA is provided to you for free of charge! You can share this EA on any website or any forums. 
//
// CFTC RULE 4.41
// HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED 
// RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-
// OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS, 
// IN GENERAL, ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING 
// MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.
//
// U.S. Government Required Disclaimer.
// Commodity Futures Trading Commission Futures and Options trading has large potential rewards, but also large potential risk. 
// You must be aware the risks and be willing to accept them in order to invest in the futures and options markets. 
// Don't trade with money you can't afford to lose. This is neither a solicitation nor an offer to Buy/Sell futures or options.
// No representation is being made that any account will or is likely to achieve profits or losses similar 
// to those discussed on this website. The past performance of any trading system or methodology is not necessarily 
// indicative of future results.
//
// USE THIS EA AT YOUR OWN RISK. 
//
//                      DO NOT DELETE THIS HEADER
//             DELETING THIS HEADER IS COPYRIGHT INFRIGMENT 
//+------------------------------------------------------------------+

#property copyright "Copyright 2017"
#property link      "https://mt4talk.com"
#property version   "1.00"
#property strict
extern double Lotsize=1;
extern int Magic_Number=12345;
extern bool Hidden=false;
extern bool Close_opposit_signal=true;
extern double Stop_Loss=0;
extern double Take_Profit=0;
extern double Trailing_Stop=0;
extern int Max_Nr_Of_Trades=0;
extern int Max_Nr_Of_Buy_Trades=0;
extern int Max_Nr_Of_Sell_Trades=0; 
extern bool DayFilter=false; 
extern bool TimeFilter=false;
 
double Risk=0;

double Martingale_Value=0;

bool FixSL=0;
int Money_Management=1;

int cntmartin=0;
double ts=0;
double be=0;
double sl,tp;
int mp;
datetime lasttrade;


 

 

int OnInit() 
 
{ 
    mp=1;
    if (Digits==5 || Digits==3) mp=10; 
    lasttrade=TimeCurrent();
    cntmartin=0;
    
    if (Money_Management==1)   
    {
       Stop_Loss=Stop_Loss/MarketInfo(Symbol(),MODE_TICKVALUE)/mp/Lotsize;
       Take_Profit=Take_Profit/MarketInfo(Symbol(),MODE_TICKVALUE)/mp/Lotsize;
       Break_Even=Break_Even/MarketInfo(Symbol(),MODE_TICKVALUE)/mp/Lotsize;
       Trailing_Stop=Trailing_Stop/MarketInfo(Symbol(),MODE_TICKVALUE)/mp/Lotsize;
    }

    //---
    return(INIT_SUCCEEDED);

} 

 
void OnDeinit(const int reason)
 
{} 

 
void OnTick()
{
    bool TradeAllow=false;
    bool buy_signal=false;
    bool sell_signal=false;
    double sl;
    double tp;
    double lotsize;
    
 
    buy_signal=GetSignal(OP_BUY);
    sell_signal=GetSignal(OP_SELL);
 
    //---       
    if((CloseSignal(OP_BUY)) ||
        (sell_signal && Close_opposit_signal))
    {
      CloseOrders(OP_BUY);
    }
    if((CloseSignal(OP_SELL)) ||
        (buy_signal && Close_opposit_signal))
    {
      CloseOrders(OP_SELL);
    }
 
    if(buy_signal)
    {
        if (Money_Management==2)
        {
            double entry;
        
            entry=MarketInfo(Symbol(),MODE_ASK);
            if(FixSL)
            {    
                sl=NormalizeDouble(entry-Stop_Loss*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS));     
                Lotsize=NormalizeDouble(CalcLotsize(Symbol(),entry,sl,Risk),2);
                tp=NormalizeDouble(entry+CalcDistance(Take_Profit,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS)); 
            }
            else
            {
                sl=NormalizeDouble(entry-CalcDistance(Stop_Loss,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS));     
                tp=NormalizeDouble(entry+CalcDistance(Take_Profit,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS)); 
            }
                
        }
                   
                   
        if (GetLastProfit(lotsize)<0 && Martingale_Type>0)
        {
            Lotsize=lotsize;
            cntmartin++;
        }
        else
        {
            cntmartin=0;
        }
          
        if (Martingale_Type==1)//Increment
        {
            Lotsize+=Martingale_Value;
        }
                
        if (Martingale_Type==2)//Multipli
        {
            Lotsize*=Martingale_Value;
        }
        
        OpenOrder(OP_BUY);
    }
    if(sell_signal)
    {
        if (Money_Management==2)
        {
            double entry;
            entry=MarketInfo(Symbol(),MODE_BID);
            if(FixSL)
            {
                sl=NormalizeDouble(entry+Stop_Loss*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS));
                Lotsize=NormalizeDouble(CalcLotsize(Symbol(),entry,sl,Risk),2);
                tp=NormalizeDouble(entry-CalcDistance(Take_Profit,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS)); 
            }
            else
            {
                sl=NormalizeDouble(entry+CalcDistance(Stop_Loss,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS));     
                tp=NormalizeDouble(entry-CalcDistance(Take_Profit,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS)); 
            }
        }
                
                
        if (GetLastProfit(lotsize)<0 && Martingale_Type>0)
        {
            Lotsize=lotsize;
            cntmartin++;
        }
        else
        {
            cntmartin=0;
        }
              
        if (Martingale_Type==1)//Increment
        {
            Lotsize+=Martingale_Value;
        }
                    
        if (Martingale_Type==2)//Multipli
        {
            Lotsize*=Martingale_Value;
        }
        OpenOrder(OP_SELL);
    }
} 
 
bool GetSignal(int type)
{
    bool b=false;
     
 
    return(b);
} 
 
bool CloseSignal(int type)
{
    bool b=false;
     
 
    return(b);
}
 
void OpenOrder(int type)
{
   int ticket=-1;
   int err=0;
  
    if(type==OP_BUY)
    {
        ticket = OrderSend(Symbol(), OP_BUY, Lotsize, MarketInfo(Symbol(), MODE_ASK), 10, 0, 0,"", Magic_Number);       
        if(ticket<0)
        {
            err=GetLastError();
            //Print ('Error!. Cannot Open BUY, failed with error : ',err);
        }
        else
        {
            if(Money_Management<2)
            {
                sl=NormalizeDouble(MarketInfo(Symbol(), MODE_ASK)-Stop_Loss*mp*MarketInfo(Symbol(),MODE_POINT), MarketInfo(Symbol(),MODE_DIGITS));
                tp=NormalizeDouble(MarketInfo(Symbol(), MODE_ASK)+Take_Profit*mp*MarketInfo(Symbol(),MODE_POINT), MarketInfo(Symbol(),MODE_DIGITS));
            }
            OrderModify(ticket, MarketInfo(Symbol(), MODE_ASK), sl, tp,0);//open price=MarketInfo(Symbol(), MODE_ASK)
        }
    }

    if(type==OP_SELL)
    {
        ticket = OrderSend(Symbol(), OP_BUY, Lotsize, MarketInfo(Symbol(), MODE_BID), 10, 0, 0,"", Magic_Number);       
        if(ticket<0)
        {
            err=GetLastError();
            //Print ('Error!. Cannot Open BUY, failed with error : ',err);
        }
        else
        {
            if(Money_Management<2)
            {
                sl=NormalizeDouble(MarketInfo(Symbol(), MODE_BID)+Stop_Loss*mp*MarketInfo(Symbol(),MODE_POINT), MarketInfo(Symbol(),MODE_DIGITS));
                tp=NormalizeDouble(MarketInfo(Symbol(), MODE_BID)-Take_Profit*mp*MarketInfo(Symbol(),MODE_POINT), MarketInfo(Symbol(),MODE_DIGITS));
            }
            OrderModify(ticket, MarketInfo(Symbol(), MODE_BID), sl, tp,0);//open price=MarketInfo(Symbol(), MODE_ASK)
        }
    }
}
 
void CloseOrders(int type)
{
   int total  = OrdersTotal();
   for (int i = total-1 ; i >=0 ; i--)
   {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && 
        OrderMagicNumber() == Magic_Number && 
        OrderSymbol() == Symbol() && 
        type==OrderType()) 
        {
            switch(OrderType())
            {
                case OP_BUY:
                {
                    OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),10);
                    break;  
                }
                                  
                case OP_SELL:
                {
                    OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),10);
                    break;
                }
            }             
        }
    }
}
 
bool IsNewBar()
{
    if (lasttrade<iTime(Symbol(),0,0))
    {
        lasttrade=iTime(Symbol(),0,0);
        return (true);
    }
    return (false);
}
int GetNrOfTrades(int type)
{
   int t=0;
   
   int total = OrdersTotal();
   int count;
   if(type==OP_BUY || type==OP_SELL)
   {
       for(count = total - 1; count >= 0; count--)
       {
          if(!OrderSelect(count, SELECT_BY_POS, MODE_TRADES)) continue;
          if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic_Number && OrderType()==type)
          {
             t++;
          }
       }
       return (t);
   }
   else if(type==6)
   {
       for(count = total - 1; count >= 0; count--)
       {
          if(!OrderSelect(count, SELECT_BY_POS, MODE_TRADES)) continue;
          if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic_Number)
          {
             t++;
          }
       }
       return (t);
   }
   return(t);
}
    
 
double CalcLotsize(string symbol,double entry, double sl,double risk)
{
   
   double qty,riskm,dist; 
   dist=MathAbs(entry-sl)/MarketInfo(symbol,MODE_POINT);
   riskm=AccountBalance()*risk/100;
   
   qty=riskm/(dist*MarketInfo(symbol,MODE_TICKVALUE));  
   return( NormalizeDouble(qty,2) );
}
    
 
void Trailing(double Trailing_Stop)
{
  int err;
   double sl = 0;
   bool result;
   
   //
   sl = OrderStopLoss();
   if(OrderType() == OP_BUY)
   {
      if((MarketInfo(Symbol(),MODE_BID) > (OrderOpenPrice() + Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT))) )
      {                        
         
         if(OrderStopLoss() == 0) sl = MarketInfo(Symbol(),MODE_BID) - Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT);
         if(OrderStopLoss() != 0 && MarketInfo(Symbol(),MODE_BID) >= OrderStopLoss() + Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT)) sl = MarketInfo(Symbol(),MODE_BID) - Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT);
         while(IsTradeContextBusy()) Sleep(100);
         if(sl > OrderStopLoss())
         {
            ResetLastError();
            result = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(sl, MarketInfo(Symbol(),MODE_DIGITS)), OrderTakeProfit(), 0, CLR_NONE);
            //
            if (result)
            {               
               Print("Trailing Stop updated: #", OrderTicket(), "; SL = ", DoubleToStr(OrderStopLoss(), MarketInfo(Symbol(),MODE_DIGITS)), "; Bid = ", DoubleToStr(MarketInfo(Symbol(),MODE_BID), MarketInfo(Symbol(),MODE_DIGITS)));
            }
            else
            {
               err = GetLastError();
               Print("Error!. Trailing Stop #", OrderTicket(), " order modify failed with error(",err,")");
            }
         }
      }
   }//if(OrderType() == OP_BUY)
   //
   if(OrderType() == OP_SELL)
   {
      
      if((MarketInfo(Symbol(),MODE_ASK) < (OrderOpenPrice() - Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT))))
      {
         
         if(OrderStopLoss() == 0) sl = MarketInfo(Symbol(),MODE_ASK) + (Trailing_Stop*mp)*MarketInfo(Symbol(),MODE_POINT);
         if(OrderStopLoss() != 0 && MarketInfo(Symbol(),MODE_ASK) <= OrderStopLoss() - Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT)) sl = MarketInfo(Symbol(),MODE_ASK) + (Trailing_Stop*mp)*MarketInfo(Symbol(),MODE_POINT);
         while(IsTradeContextBusy()) Sleep(100);
         if(sl < OrderStopLoss())
         {
            ResetLastError();
            result = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(sl, MarketInfo(Symbol(),MODE_DIGITS)), OrderTakeProfit(), 0, CLR_NONE);
            //
            if (result)
            {
               Print("Trailing Stop updated: #", OrderTicket(), "; SL = ", DoubleToStr(sl, MarketInfo(Symbol(),MODE_DIGITS)), "; Ask = ", DoubleToStr(MarketInfo(Symbol(),MODE_ASK), MarketInfo(Symbol(),MODE_DIGITS)));
            }
            else
            {
               err = GetLastError();
               Print("Error!. Trailing Stop #", OrderTicket(), " order modify failed with error(",err,")");
            }
         }
      }
   }
}
    
 
void ManageTrades()
{
   int t=OrdersTotal();
   for(int i=t-1;i>=0;i--)
   {
      if(OrderSelect(i,SELECT_BY_POS))
      {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic_Number)
         {
            if (!Hidden)
            {
                if (Money_Management==2)
                {
                    ts=CalcDistance(Trailing_Stop,OrderLots());//OrderLots
                    be=CalcDistance(Break_Even,OrderLots()); 
                }
                else
                {
                    ts=Trailing_Stop;
                    be=Break_Even;
                }
                
                if (Break_Even>0)
                {
                    BreakEven(be);
                }
                if (Trailing_Stop>0)
                {
                    Trailing(ts);
                }
            }
           
         
         }
      }
   }//for end
}
    
 
    
void BreakEven(double Break_Even)
{
   bool result;
   double sl;
   int err;
   //
   ResetLastError();
   if(OrderType() == OP_BUY)
   {
       if(OrderStopLoss() >= OrderOpenPrice()) return;
       
       if (MarketInfo(Symbol(),MODE_BID) >= OrderOpenPrice() + Break_Even*mp*MarketInfo(Symbol(),MODE_POINT))
       {
         sl= OrderOpenPrice() ;
         while(IsTradeContextBusy()) Sleep(100);
         result = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(sl, MarketInfo(Symbol(),MODE_DIGITS)), OrderTakeProfit(), 0, CLR_NONE);
         if (result)
         {
            Print("Break Even stop updated: #", OrderTicket(), "; SL = ", DoubleToStr(sl, MarketInfo(Symbol(),MODE_DIGITS)), "; Bid = ", DoubleToStr(MarketInfo(Symbol(),MODE_BID), MarketInfo(Symbol(),MODE_DIGITS)));
         }
         else
         {
            err = GetLastError();
            Print("Error!. Break Even #", OrderTicket(), " order modify failed with error(",err,")");
         }
       }
   }
   //
   if (OrderType() == OP_SELL) 
   {
       if (OrderStopLoss() <= OrderOpenPrice() && OrderStopLoss() != 0) return;
       
       if (MarketInfo(Symbol(),MODE_ASK) <= OrderOpenPrice() - Break_Even*mp*MarketInfo(Symbol(),MODE_POINT))
       {
         sl = OrderOpenPrice() ;
         while(IsTradeContextBusy()) Sleep(100);
         result = OrderModify(OrderTicket(),OrderOpenPrice(), NormalizeDouble(sl, MarketInfo(Symbol(),MODE_DIGITS)), OrderTakeProfit(), 0, CLR_NONE);
         if (result)
         {           
            Print("Break Even stop updated: # ", OrderTicket(), "; SL = ", DoubleToStr(sl, MarketInfo(Symbol(),MODE_DIGITS)), "; Ask = ", DoubleToStr(MarketInfo(Symbol(),MODE_ASK), MarketInfo(Symbol(),MODE_DIGITS)));
         }
         else
         {
            err = GetLastError();
            Print("Error!. Break Even #", OrderTicket(), " order modify failed with error(",err,")");
         }
       }
   }
}
    
 
double CalcDistance(double risk, double lotsize)
{
   risk=AccountBalance()*risk/100;
   return (risk/MarketInfo(Symbol(),MODE_TICKVALUE)/mp/lotsize);
}

 
double GetLastProfit(double& lotsize)
{
   int t=OrdersTotal();
   double p=0;
   datetime mt=0;
   
   for (int i=t-1;i>=0;i--)
   {
      if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {
         if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic_Number && OrderCloseTime()>mt)
         {
            mt=OrderCloseTime();
            p=OrderProfit();
            lotsize=OrderLots();
         }
      }
   }
   
   return (p);
}

Please, can you re-load your robot? The one you put on the forum does not work. Thanks.

good and sharp ,close only with profits and never with losses

//+------------------------------------------------------------------+
//                        DO NOT DELETE THIS HEADER
//             DELETING THIS HEADER IS COPYRIGHT INFRIGMENT 
//
//                   Copyright ©2017, https://mt4talk.com
//                     MT4talk Expert Advisor Generator
//                        https://mt4talk.com/eagenerator/
//
// THIS EXPERT ADVISOR (EA) HAS BEEN GENERATED USING MT4talk EA GENERATOR. 
// 
// Disclaimer: This EA is provided to you "AS-IS", and MT4talk disclaims any warranty
// or liability obligations to you of any kind. 
//
// FREE EA LICENSE
// This EA is provided to you for free of charge! You can share this EA on any website or any forums. 
//
// CFTC RULE 4.41
// HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED 
// RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-
// OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS, 
// IN GENERAL, ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING 
// MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.
//
// U.S. Government Required Disclaimer.
// Commodity Futures Trading Commission Futures and Options trading has large potential rewards, but also large potential risk. 
// You must be aware the risks and be willing to accept them in order to invest in the futures and options markets. 
// Don't trade with money you can't afford to lose. This is neither a solicitation nor an offer to Buy/Sell futures or options.
// No representation is being made that any account will or is likely to achieve profits or losses similar 
// to those discussed on this website. The past performance of any trading system or methodology is not necessarily 
// indicative of future results.
//
// USE THIS EA AT YOUR OWN RISK. 
//
//                      DO NOT DELETE THIS HEADER
//             DELETING THIS HEADER IS COPYRIGHT INFRIGMENT 
//+------------------------------------------------------------------+

#property copyright "Copyright 2017"
#property link      "https://mt4talk.com"
#property version   "1.00"
#property strict
extern double Lotsize=1;
extern int Magic_Number=12345;
extern bool Hidden=false;
extern bool Close_opposit_signal=true;
extern double Stop_Loss=0;
extern double Take_Profit=0;
extern double Trailing_Stop=0;
extern int Max_Nr_Of_Trades=0;
extern int Max_Nr_Of_Buy_Trades=0;
extern int Max_Nr_Of_Sell_Trades=0; 
extern bool DayFilter=false; 
extern bool TimeFilter=false;
 
double Risk=0;

double Martingale_Value=0;

bool FixSL=0;
int Money_Management=1;

int cntmartin=0;
double ts=0;
double be=0;
double sl,tp;
int mp;
datetime lasttrade;


 

 

int OnInit() 
 
{ 
    mp=1;
    if (Digits==5 || Digits==3) mp=10; 
    lasttrade=TimeCurrent();
    cntmartin=0;
    
    if (Money_Management==1)   
    {
       Stop_Loss=Stop_Loss/MarketInfo(Symbol(),MODE_TICKVALUE)/mp/Lotsize;
       Take_Profit=Take_Profit/MarketInfo(Symbol(),MODE_TICKVALUE)/mp/Lotsize;
       Break_Even=Break_Even/MarketInfo(Symbol(),MODE_TICKVALUE)/mp/Lotsize;
       Trailing_Stop=Trailing_Stop/MarketInfo(Symbol(),MODE_TICKVALUE)/mp/Lotsize;
    }

    //---
    return(INIT_SUCCEEDED);

} 

 
void OnDeinit(const int reason)
 
{} 

 
void OnTick()
{
    bool TradeAllow=false;
    bool buy_signal=false;
    bool sell_signal=false;
    double sl;
    double tp;
    double lotsize;
    
 
    buy_signal=GetSignal(OP_BUY);
    sell_signal=GetSignal(OP_SELL);
 
    //---       
    if((CloseSignal(OP_BUY)) ||
        (sell_signal && Close_opposit_signal))
    {
      CloseOrders(OP_BUY);
    }
    if((CloseSignal(OP_SELL)) ||
        (buy_signal && Close_opposit_signal))
    {
      CloseOrders(OP_SELL);
    }
 
    if(buy_signal)
    {
        if (Money_Management==2)
        {
            double entry;
        
            entry=MarketInfo(Symbol(),MODE_ASK);
            if(FixSL)
            {    
                sl=NormalizeDouble(entry-Stop_Loss*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS));     
                Lotsize=NormalizeDouble(CalcLotsize(Symbol(),entry,sl,Risk),2);
                tp=NormalizeDouble(entry+CalcDistance(Take_Profit,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS)); 
            }
            else
            {
                sl=NormalizeDouble(entry-CalcDistance(Stop_Loss,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS));     
                tp=NormalizeDouble(entry+CalcDistance(Take_Profit,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS)); 
            }
                
        }
                   
                   
        if (GetLastProfit(lotsize)<0 && Martingale_Type>0)
        {
            Lotsize=lotsize;
            cntmartin++;
        }
        else
        {
            cntmartin=0;
        }
          
        if (Martingale_Type==1)//Increment
        {
            Lotsize+=Martingale_Value;
        }
                
        if (Martingale_Type==2)//Multipli
        {
            Lotsize*=Martingale_Value;
        }
        
        OpenOrder(OP_BUY);
    }
    if(sell_signal)
    {
        if (Money_Management==2)
        {
            double entry;
            entry=MarketInfo(Symbol(),MODE_BID);
            if(FixSL)
            {
                sl=NormalizeDouble(entry+Stop_Loss*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS));
                Lotsize=NormalizeDouble(CalcLotsize(Symbol(),entry,sl,Risk),2);
                tp=NormalizeDouble(entry-CalcDistance(Take_Profit,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS)); 
            }
            else
            {
                sl=NormalizeDouble(entry+CalcDistance(Stop_Loss,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS));     
                tp=NormalizeDouble(entry-CalcDistance(Take_Profit,Lotsize)*mp*Point(),(int)MarketInfo(Symbol(),MODE_DIGITS)); 
            }
        }
                
                
        if (GetLastProfit(lotsize)<0 && Martingale_Type>0)
        {
            Lotsize=lotsize;
            cntmartin++;
        }
        else
        {
            cntmartin=0;
        }
              
        if (Martingale_Type==1)//Increment
        {
            Lotsize+=Martingale_Value;
        }
                    
        if (Martingale_Type==2)//Multipli
        {
            Lotsize*=Martingale_Value;
        }
        OpenOrder(OP_SELL);
    }
} 
 
bool GetSignal(int type)
{
    bool b=false;
     
 
    return(b);
} 
 
bool CloseSignal(int type)
{
    bool b=false;
     
 
    return(b);
}
 
void OpenOrder(int type)
{
   int ticket=-1;
   int err=0;
  
    if(type==OP_BUY)
    {
        ticket = OrderSend(Symbol(), OP_BUY, Lotsize, MarketInfo(Symbol(), MODE_ASK), 10, 0, 0,"", Magic_Number);       
        if(ticket<0)
        {
            err=GetLastError();
            //Print ('Error!. Cannot Open BUY, failed with error : ',err);
        }
        else
        {
            if(Money_Management<2)
            {
                sl=NormalizeDouble(MarketInfo(Symbol(), MODE_ASK)-Stop_Loss*mp*MarketInfo(Symbol(),MODE_POINT), MarketInfo(Symbol(),MODE_DIGITS));
                tp=NormalizeDouble(MarketInfo(Symbol(), MODE_ASK)+Take_Profit*mp*MarketInfo(Symbol(),MODE_POINT), MarketInfo(Symbol(),MODE_DIGITS));
            }
            OrderModify(ticket, MarketInfo(Symbol(), MODE_ASK), sl, tp,0);//open price=MarketInfo(Symbol(), MODE_ASK)
        }
    }

    if(type==OP_SELL)
    {
        ticket = OrderSend(Symbol(), OP_BUY, Lotsize, MarketInfo(Symbol(), MODE_BID), 10, 0, 0,"", Magic_Number);       
        if(ticket<0)
        {
            err=GetLastError();
            //Print ('Error!. Cannot Open BUY, failed with error : ',err);
        }
        else
        {
            if(Money_Management<2)
            {
                sl=NormalizeDouble(MarketInfo(Symbol(), MODE_BID)+Stop_Loss*mp*MarketInfo(Symbol(),MODE_POINT), MarketInfo(Symbol(),MODE_DIGITS));
                tp=NormalizeDouble(MarketInfo(Symbol(), MODE_BID)-Take_Profit*mp*MarketInfo(Symbol(),MODE_POINT), MarketInfo(Symbol(),MODE_DIGITS));
            }
            OrderModify(ticket, MarketInfo(Symbol(), MODE_BID), sl, tp,0);//open price=MarketInfo(Symbol(), MODE_ASK)
        }
    }
}
 
void CloseOrders(int type)
{
   int total  = OrdersTotal();
   for (int i = total-1 ; i >=0 ; i--)
   {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && 
        OrderMagicNumber() == Magic_Number && 
        OrderSymbol() == Symbol() && 
        type==OrderType()) 
        {
            switch(OrderType())
            {
                case OP_BUY:
                {
                    OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),10);
                    break;  
                }
                                  
                case OP_SELL:
                {
                    OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),10);
                    break;
                }
            }             
        }
    }
}
 
bool IsNewBar()
{
    if (lasttrade<iTime(Symbol(),0,0))
    {
        lasttrade=iTime(Symbol(),0,0);
        return (true);
    }
    return (false);
}
int GetNrOfTrades(int type)
{
   int t=0;
   
   int total = OrdersTotal();
   int count;
   if(type==OP_BUY || type==OP_SELL)
   {
       for(count = total - 1; count >= 0; count--)
       {
          if(!OrderSelect(count, SELECT_BY_POS, MODE_TRADES)) continue;
          if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic_Number && OrderType()==type)
          {
             t++;
          }
       }
       return (t);
   }
   else if(type==6)
   {
       for(count = total - 1; count >= 0; count--)
       {
          if(!OrderSelect(count, SELECT_BY_POS, MODE_TRADES)) continue;
          if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic_Number)
          {
             t++;
          }
       }
       return (t);
   }
   return(t);
}
    
 
double CalcLotsize(string symbol,double entry, double sl,double risk)
{
   
   double qty,riskm,dist; 
   dist=MathAbs(entry-sl)/MarketInfo(symbol,MODE_POINT);
   riskm=AccountBalance()*risk/100;
   
   qty=riskm/(dist*MarketInfo(symbol,MODE_TICKVALUE));  
   return( NormalizeDouble(qty,2) );
}
    
 
void Trailing(double Trailing_Stop)
{
  int err;
   double sl = 0;
   bool result;
   
   //
   sl = OrderStopLoss();
   if(OrderType() == OP_BUY)
   {
      if((MarketInfo(Symbol(),MODE_BID) > (OrderOpenPrice() + Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT))) )
      {                        
         
         if(OrderStopLoss() == 0) sl = MarketInfo(Symbol(),MODE_BID) - Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT);
         if(OrderStopLoss() != 0 && MarketInfo(Symbol(),MODE_BID) >= OrderStopLoss() + Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT)) sl = MarketInfo(Symbol(),MODE_BID) - Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT);
         while(IsTradeContextBusy()) Sleep(100);
         if(sl > OrderStopLoss())
         {
            ResetLastError();
            result = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(sl, MarketInfo(Symbol(),MODE_DIGITS)), OrderTakeProfit(), 0, CLR_NONE);
            //
            if (result)
            {               
               Print("Trailing Stop updated: #", OrderTicket(), "; SL = ", DoubleToStr(OrderStopLoss(), MarketInfo(Symbol(),MODE_DIGITS)), "; Bid = ", DoubleToStr(MarketInfo(Symbol(),MODE_BID), MarketInfo(Symbol(),MODE_DIGITS)));
            }
            else
            {
               err = GetLastError();
               Print("Error!. Trailing Stop #", OrderTicket(), " order modify failed with error(",err,")");
            }
         }
      }
   }//if(OrderType() == OP_BUY)
   //
   if(OrderType() == OP_SELL)
   {
      
      if((MarketInfo(Symbol(),MODE_ASK) < (OrderOpenPrice() - Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT))))
      {
         
         if(OrderStopLoss() == 0) sl = MarketInfo(Symbol(),MODE_ASK) + (Trailing_Stop*mp)*MarketInfo(Symbol(),MODE_POINT);
         if(OrderStopLoss() != 0 && MarketInfo(Symbol(),MODE_ASK) <= OrderStopLoss() - Trailing_Stop*mp*MarketInfo(Symbol(),MODE_POINT)) sl = MarketInfo(Symbol(),MODE_ASK) + (Trailing_Stop*mp)*MarketInfo(Symbol(),MODE_POINT);
         while(IsTradeContextBusy()) Sleep(100);
         if(sl < OrderStopLoss())
         {
            ResetLastError();
            result = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(sl, MarketInfo(Symbol(),MODE_DIGITS)), OrderTakeProfit(), 0, CLR_NONE);
            //
            if (result)
            {
               Print("Trailing Stop updated: #", OrderTicket(), "; SL = ", DoubleToStr(sl, MarketInfo(Symbol(),MODE_DIGITS)), "; Ask = ", DoubleToStr(MarketInfo(Symbol(),MODE_ASK), MarketInfo(Symbol(),MODE_DIGITS)));
            }
            else
            {
               err = GetLastError();
               Print("Error!. Trailing Stop #", OrderTicket(), " order modify failed with error(",err,")");
            }
         }
      }
   }
}
    
 
void ManageTrades()
{
   int t=OrdersTotal();
   for(int i=t-1;i>=0;i--)
   {
      if(OrderSelect(i,SELECT_BY_POS))
      {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic_Number)
         {
            if (!Hidden)
            {
                if (Money_Management==2)
                {
                    ts=CalcDistance(Trailing_Stop,OrderLots());//OrderLots
                    be=CalcDistance(Break_Even,OrderLots()); 
                }
                else
                {
                    ts=Trailing_Stop;
                    be=Break_Even;
                }
                
                if (Break_Even>0)
                {
                    BreakEven(be);
                }
                if (Trailing_Stop>0)
                {
                    Trailing(ts);
                }
            }
           
         
         }
      }
   }//for end
}
    
 
    
void BreakEven(double Break_Even)
{
   bool result;
   double sl;
   int err;
   //
   ResetLastError();
   if(OrderType() == OP_BUY)
   {
       if(OrderStopLoss() >= OrderOpenPrice()) return;
       
       if (MarketInfo(Symbol(),MODE_BID) >= OrderOpenPrice() + Break_Even*mp*MarketInfo(Symbol(),MODE_POINT))
       {
         sl= OrderOpenPrice() ;
         while(IsTradeContextBusy()) Sleep(100);
         result = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(sl, MarketInfo(Symbol(),MODE_DIGITS)), OrderTakeProfit(), 0, CLR_NONE);
         if (result)
         {
            Print("Break Even stop updated: #", OrderTicket(), "; SL = ", DoubleToStr(sl, MarketInfo(Symbol(),MODE_DIGITS)), "; Bid = ", DoubleToStr(MarketInfo(Symbol(),MODE_BID), MarketInfo(Symbol(),MODE_DIGITS)));
         }
         else
         {
            err = GetLastError();
            Print("Error!. Break Even #", OrderTicket(), " order modify failed with error(",err,")");
         }
       }
   }
   //
   if (OrderType() == OP_SELL) 
   {
       if (OrderStopLoss() <= OrderOpenPrice() && OrderStopLoss() != 0) return;
       
       if (MarketInfo(Symbol(),MODE_ASK) <= OrderOpenPrice() - Break_Even*mp*MarketInfo(Symbol(),MODE_POINT))
       {
         sl = OrderOpenPrice() ;
         while(IsTradeContextBusy()) Sleep(100);
         result = OrderModify(OrderTicket(),OrderOpenPrice(), NormalizeDouble(sl, MarketInfo(Symbol(),MODE_DIGITS)), OrderTakeProfit(), 0, CLR_NONE);
         if (result)
         {           
            Print("Break Even stop updated: # ", OrderTicket(), "; SL = ", DoubleToStr(sl, MarketInfo(Symbol(),MODE_DIGITS)), "; Ask = ", DoubleToStr(MarketInfo(Symbol(),MODE_ASK), MarketInfo(Symbol(),MODE_DIGITS)));
         }
         else
         {
            err = GetLastError();
            Print("Error!. Break Even #", OrderTicket(), " order modify failed with error(",err,")");
         }
       }
   }
}
    
 
double CalcDistance(double risk, double lotsize)
{
   risk=AccountBalance()*risk/100;
   return (risk/MarketInfo(Symbol(),MODE_TICKVALUE)/mp/lotsize);
}

 
double GetLastProfit(double& lotsize)
{
   int t=OrdersTotal();
   double p=0;
   datetime mt=0;
   
   for (int i=t-1;i>=0;i--)
   {
      if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {
         if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic_Number && OrderCloseTime()>mt)
         {
            mt=OrderCloseTime();
            p=OrderProfit();
            lotsize=OrderLots();
         }
      }
   }
   
   return (p);
}
mdnazri.shamsudin wrote:
sasastephe wrote:

I do not think it's a good idea to use a cent account
it's exactly the same configuration as with a standard account
let me explain
if you trade 200 dolars that represents 20000 cents. but you should not use the setting 20 k file but the setting 2000 file, otherwise you will have a margin problem. using this expert on a standard account or cent and taking the corresponding setttings files your margin will be divided by 10.
you absolutely need a broker 4 digits and with micro account. Do you think I'm right?


You won't know unless you try it. Yes it is the same configuration but bear in mind if you use a cent account you are risking much less since you are only losing $200 instead of $20k. You can try it on any settings you want, it all depends on your risk tolerance and how much profit you want to make.

If you use the 2k set file your profit is obviously much lesser than a 20k set file, but safer. It's up to you.

we agree then

sasastephe wrote:

I do not think it's a good idea to use a cent account
it's exactly the same configuration as with a standard account
let me explain
if you trade 200 dolars that represents 20000 cents. but you should not use the setting 20 k file but the setting 2000 file, otherwise you will have a margin problem. using this expert on a standard account or cent and taking the corresponding setttings files your margin will be divided by 10.
you absolutely need a broker 4 digits and with micro account. Do you think I'm right?

You won't know unless you try it. Yes it is the same configuration but bear in mind if you use a cent account you are risking much less since you are only losing $200 instead of $20k. You can try it on any settings you want, it all depends on your risk tolerance and how much profit you want to make.

If you use the 2k set file your profit is obviously much lesser than a 20k set file, but safer. It's up to you.

Posts found: 101 to 110 of 3,096

Pages Previous 1 9 10 11 12 13 310 Next

Profit → ► MT4talk - FREE Forex Robots and more... → Search results


NOTE: Hacked or illegal versions of copyrighted Forex robots are highly prohibited on MT4talk.com. If you upload any illegal version of any copyrighted Forex robot, your forum account will be banned. No exceptions.

 

IMPORTANT: MT4talk.com is a public Forex forum, where forum members can upload open source Forex robots to share with other members. MT4talk.com forum does not sell or rent Forex robots, and does not provide guarantee or support for the uploaded Forex robots! If you have any question about any Forex robot, please open a forum topic! If you have a question about your forum account, contact: mt4talk@gmail.com

CFTC RULE 4.41 – HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS, IN GENERAL, ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.

Disclaimer - No representation is being made that any Forex account will or is likely to achieve profits or losses similar to those shown on backtests in this forum. In fact, there are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical trading does not involve financial risk, and no hypothetical trading record can completely account for the impact of financial risk in actual trading. 
All information on this forum is for educational purposes only and is not intended to provide financial advice. Any statements posted by forum members about profits or income expressed or implied, do not represent a guarantee. Your actual trading may result in losses as no trading system is guaranteed. You accept full responsibilities for your actions, trades, profit or loss, and agree to hold the MT4talk team and forum members of this information harmless in any and all ways.


Copyright MT4talk.com Forum Rules - Privacy Policy.