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

Log-In or Register to get unlimited download access of Forex Robots!

Login with Facebook!

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

Forex Fx charger

by jp1_imports

theofx

by kgoraps

helo ea

by Saurabh Verma


Pages 1

You must login or register to post a reply

RSS

Posts: 1
Please rate this topic
Current rating: 0
Votes: 0

Embed topic to your site

MT5 MQL5 Trading EA

Topic: MT5 MQL5 Trading EA

Hello,

Bases on the SimpleCancelOrder EA of mql5tutorial.com I created my own trading EA only suitable in MT5.

If the EA has in total less than 15 positions open it will open new sell stop and buy stop orders. With TP and SL. All values are configurable at the Inputs tab. The EA also cancels the pending order if market prices has gone the other direction. It comments on the chart several variables. It has a dynamic lot sizing bases on the equity. It makes with the current setting on my roboforex demo account about 600 euro profit using 2000 and 1:500 leverage.

#include<Trade\Trade.mqh>
CTrade  trade;
input int BuyTP = 252;
input int BuySL = 1019;
input int SellTP = 1193;
input int SellSL = 883;
input int Offset = 299;

void OnTick()
  {
   double Balance = AccountInfoDouble(ACCOUNT_BALANCE);
   double Equity = AccountInfoDouble(ACCOUNT_EQUITY);
   double Ask = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
   double Bid = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);
   double PositionSize = NormalizeDouble((Equity/100000),2);
   if (PositionSize < 0.01) PositionSize = 0.01;

   // if we have no open position and no order
   if (PositionsTotal()<=15 && OrdersTotal()<=15)
   { 
     Comment ("\n ### PositionsTotal: ",PositionsTotal(), "\n OrdersTotal: ",OrdersTotal());
     // buy stop, 10 microlots, 100 points above Ask, no SL, 
     // 300 points TP, no expiration, no date, no comment
     trade.BuyStop(PositionSize,Ask+Offset*_Point,_Symbol,Ask-BuySL*_Point,Ask+BuyTP*_Point,ORDER_TIME_GTC,NULL);
     
     // sell stop, 10 microlots, 100 points below Bid, no SL, 
     // 300 points TP, no expiration, no date, no comment
     trade.SellStop(PositionSize,Bid-Offset*_Point,_Symbol,Bid+SellSL*_Point,Bid-SellTP*_Point,ORDER_TIME_GTC,NULL);
   }
   Comment ("Position Size: ",PositionSize,"\n PosTotal: ",PositionsTotal(), "\n OrdersTotal: ",OrdersTotal(),"\n Spread: ",(Ask-Bid)*_Point);
   // if we have at least 1 position
   if (Balance!=Equity) CancelOrder();   
}

void CancelOrder()
  {
      // check all orders 
      for(int i=OrdersTotal()-1; i>=0; i--) // count all currency pair positions 
      {    
            // get the ticket number 
            ulong OrderTicket = OrderGetTicket(i);

            // Delete the pending orders
            trade.OrderDelete(OrderTicket);             
   
      } // End for loop
  } // End BreakEven Stop function
Post's attachments

MyEA - Copy.zip 918 b, 12 downloads since 2018-05-31 

Share

Thanked for the post: jozmik

Posts: 1

Test your Forex robot on leverage 1:3000!

Minimum deposit $5. (NETELLER, VISA, Skrill, Perfect Money, Scratch cards, Bitcoin and CASHU)

 


Pages 1

You must login or register to post a reply


 

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.


Copyright MT4talk.com Forum Rules - Privacy Policy.