Need Simple Mql4 code for EA.

 

I need simple EMA Cross over EA.

Both 2 EMA is apply to open

Trades only open in given time range in a day

  1. Period 35
  2. Period 3

Trade Should close when reversed signal no matter trade loss or profit.

Should work on every timeframe.

SL is open. TP should be a Input in pips.

  • When one trade open TP should only for 3/4 lot of the trade. Other 1/4 TP is open for reverse signal.
  • If current trade closed in loss next trade should multiply the lose trade lot size. Multiplication factor should be a Input.
  • All trades must close in end of the day with profits or not.
Who can Help me to develop this code.
 
sonali123:

I need simple EMA Cross over EA.

Both 2 EMA is apply to open

Trades only open in given time range in a day

  1. Period 35
  2. Period 3

Trade Should close when reversed signal no matter trade loss or profit.

Should work on every timeframe.

SL is open. TP should be a Input in pips.

  • When one trade open TP should only for 3/4 lot of the trade. Other 1/4 TP is open for reverse signal.
  • If current trade closed in loss next trade should multiply the lose trade lot size. Multiplication factor should be a Input.
  • All trades must close in end of the day with profits or not.
Who can Help me to develop this code.

Here you will find help https://www.mql5.com/en/job

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • www.mql5.com
Hi, i have an indicator in use, which needs modifications. This indicator draws Renko Boxes into a chart (like the FXBlue Renko does). Then it counts the range boxes. A renko range box is, when the price moves above a level and down again, it draws boxes. The screen shot shows it perfectly. If you dont understand the logic, dont apply, i will...
 
as the moderator said, you can find the mql4 programmer on job section.
 

Try this.

#property copyright "nicholishen"
#property link      "https://www.forexfactory.com/nicholishen"
#property version   "1.00"
#property strict
#define MAGIC 101101
//--- input parameters
input int      inpSlow=3;
input int      inpFast=35;
input double   inpSize=0.10;
input int      inpTpPoints=100;

#include <Indicators\Trend.mqh>
#include <stdlib.mqh>

CiMA ema_fast, ema_slow;
//+------------------------------------------------------------------+
int OnInit()
{
   bool create_fast = ema_fast.Create(_Symbol,(ENUM_TIMEFRAMES)_Period, 
      inpFast, 0, MODE_EMA, PRICE_CLOSE);
   bool create_slow = ema_slow.Create(_Symbol,(ENUM_TIMEFRAMES)_Period, 
      inpSlow, 0, MODE_EMA, PRICE_CLOSE);
   if(!create_fast || !create_slow)
      return INIT_FAILED;
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason){}
//+------------------------------------------------------------------+
void OnTick()
{
   static datetime last_bar_time = 0;
   if(Time[0] != last_bar_time){
      if(ema_slow.Main(1) > ema_fast.Main(1))
         go_long();
      else
         go_short();
      last_bar_time = Time[0]
   }
}
//+------------------------------------------------------------------+
void go_long()
{
   int pos = positions(OP_BUY);
   if(pos < 1 && !(pos > 1)){
      if(close_all()){
         double tp = NormalizeDouble(Ask + inpTpPoints * _Point, _Digits);
         if(OrderSend(_Symbol, OP_BUY, inpSize, Ask, 100, 0., tp) < 0)
            Alert("Trade error! " + ErrorDescription(_LastError));
      }
   }
}
//+------------------------------------------------------------------+
void go_short()
{
   int pos = positions(OP_SELL);
   if(pos < 1 && !(pos > 1)){
      if(close_all()){
         double tp = NormalizeDouble(Bid - inpTpPoints * _Point, _Digits);
         if(OrderSend(_Symbol, OP_BUY, inpSize, Bid, 100, 0., tp) < 0)
            Alert("Trade error! " + ErrorDescription(_LastError));
      }
   }
}
//+------------------------------------------------------------------+
int positions(int type)
{
   int cnt = 0;
   for(int i=OrdersTotal()-1; i>=0; --i){
      if(OrderSelect(i, SELECT_BY_POS)
         && OrderSymbol() == _Symbol
         && OrderMagicNumber() == MAGIC
         && OrderType() == type
      ){
         cnt++;
      }
   }
   return cnt;
}
//+------------------------------------------------------------------+
bool close_all()
{
   bool closed_all = true;
   for(int i=OrdersTotal()-1; i>=0; --i){
      if(OrderSelect(i, SELECT_BY_POS)
         && OrderSymbol() == _Symbol
         && OrderMagicNumber() == MAGIC
         && OrderType() < 2
      ){
         if(!OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 100)){
            Alert("Trade error! " + ErrorDescription(_LastError));
            closed_all = false;
         }
      }
   }
   return closed_all;
}   
//+------------------------------------------------------------------+
 
nicholi shen:

Try this.

Thank you very much.
 
nicholi shen:

Try this.

This gives some errors.



 

need a semicoln here:

last_bar_time = Time[0]; <-
 
sonali123:
...Who can Help me to develop this code.


One thing is having real doubts and NEED HELP on developing code. The other is asking for FREE coding in the FORUM. And this is not the first time you act like this.

And you have paid products on your account as well as a website selling mentoring. Do you think that this is FAIR PLAY?

WTF.

Reason: