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

Budak ea

by Wilber Ramirez

Hide

Recommended by Admin:

Trade with a small deposit, earn a big profit!

Try your Forex Robot on FBS Broker with a small depositleverage 1:3000ZERO Spread account!


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, 15 downloads since 2018-05-31 

Share

Thanked for the post: jozmik

Posts: 1

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.

 

Forex Risk Warning: Due to leverage, Forex comes with a high risk of losing money. Eighty to 90 percent of Forex traders lose money. You should not invest money that you cannot afford to lose.

Forum statistics

  • Total number of registered users: 23,974
  • Newest registered user: Mayk
  • Total number of topics: 11,314
  • Total number of posts: 37,116

Online users: 2,124 guests, 192 Members:

2trade2win, admin, ahmed.gooh.1, alextrader, Allan Rubini, amala3247, amtwoxtwo, angel.mayor, AnthonyT, aprice220466, b4511137, balanisunil, ball2goal, Bandeauman Gjc RG, Benjamin Flores Bta, betuboxem, billymaggot, bng7222, Boonchoke Intarapanya, Brayan, bwadd100, caballoblanc, ch4nd4, chingurikokko, chris1961GR, ciprofar, cristian, crootster, cruelzhang, d.kultida, Daniel Olokun, Darshana Samaraweera, Dat Nguyen, david_lem57, delfin20, deprofiters, dhayatsuzukiyk, dillansym, dogsbody, DomCount12, Donovan Sissing, dumisawhite, dvorynen, e.sanchez.trading, e440e48d00, e9ez9ert, Eakapun, Elfe Azrul, Ergün Ülker, fcaillou, feculanec, FloridaTraderLLC, Forex Stock Trading, forexology360, freezyabe, giodel, Gizmo79, gofire, gommcn, Gosta Strom, h.sadeghiyan, hiltomclaudemoore, hiraokii, hktsui, hondacbrr6, honvohermann, horacewh, hussain.tradeexpress, Huu Tuan Tran, ian.kungu, iddob.1999, idhamkholid, igolfishing, iharmanbajwa, inkpan, janich921, jaysonajax, jlhtrader, jmuntjan, Joe0013, jonakgames, jonifxtrader, jozmik, jp1_imports, judeekatherinexx, Justeen Munginga, kamalkumar_j, kazuo.yoshida.01, kimamo87, kindofblue79, kiruba, Kojo Bame, kozura, krisapong, krisbina, Krzysztof Błaszczyk, lawrence.jrt, Leandroleri, leitzb, liyahath17021979, logu5332, lori, luigipalm, machs_nochmal, Makari, mampanl, marbre, marcial03, martinesleonardo, matoseyems, matuskotira1, Mayk, Md Billal Hossain, mejahsonchi, miguefx, mikedyke, Mostafa Essam Nassar, Mustafa Naci Temiz, mwachii, najjarja, Nakhoda AndiQa, Nat4n, ndamulelomasindi, nmoumouni, NPleyer, Nur Hidayat, octavianus, oladelekehinde2, omitofs, oussama.dhib, Paso, Patrice Rouhard, pellingrini45, Peral, Piotr Wójtowicz, pozyczkowy, Prime, quoctu1091, Rain Forest, Raul Corrales, Raymond Makuvatsine, Richard Spong, Roytall, RUETTA, rzsster, sabinomartinez250, Sam Kimball, Saulius Balčiūnas, SebasFlo, serctes, shahbaz.star333, shahin, shailey1s, shajahan2307, siung0910, sivahemantha, smookey, soldado777, sporty, ssehrat, Sue+254, Sven Aria, Syam Danarta Hadiwidjana, tango9673, tariq.albarraq, thanasorn.b, thiaw99, thuan27, timbetapontos10, Tom Kuhn, topcat275, Travela Waramlah, tronghoang79, tuvix2, uzobusy11, Valie, vaverin, Verapan Ruampatanakit, Victoriano, Vignesh Kumar, waldisarq, walid350, why, Wilber Ramirez, wisemansibusiso454, www.fxrobogbp, xg5463, Xgar, xperts, yang, yansu75, yawa5

 


Copyright MT4talk.com Forum Rules - Privacy Policy.