Find out why EA dont open position on JFD physical stock

MQL5 Experts

Tâche terminée

Temps d'exécution 12 heures
Commentaires de l'employé
Very good customer.

Spécifications

Hello,

 

i use JFD MT5. I have an EA that opens a position on normal CFD (stock) but it fails to open the position on physical stock too.

Your job is to download MT5 from JFD here:  https://download.mql5.com/cdn/web/jfd.group.ltd/mt5/jfd5setup.exe

Create a demo account and find out why the following ea don't open a position on physical stock.

 

 

//+------------------------------------------------------------------+
//|                                              Moving Averages.mq5 |
//|                   Copyright 2009-2017, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2009-2017, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"

#include <Trade\Trade.mqh>
 
input int    MovingPeriod       = 2;      // Moving Average period
input double ClosePerc          = 0.1;
input int    MovingFilter       = 10;       // Moving Average Filter
//---
int    ExtHandle=0;
bool   ExtHedging=false;
CTrade ExtTrade;

#define MA_MAGIC 1234501
//+------------------------------------------------------------------+
//| Calculate optimal lot size                                       |
//+------------------------------------------------------------------+
double TradeSizeOptimized(void)
  {
   double price=0.0;
   double margin=0.0;
//--- select lot size
   if(!SymbolInfoDouble(_Symbol,SYMBOL_ASK,price))
      return(0.0);
   if(!OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,1.0,price,margin))
      return(0.0);
   if(margin<=0.0)
      return(0.0);

   double lot=1;
   //NormalizeDouble(AccountInfoDouble(ACCOUNT_MARGIN_FREE)*MaximumRisk/margin,2);
  
//--- calculate number of losses orders without a break
 
 
 
//--- normalize and check limits
   double stepvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
   lot=stepvol*NormalizeDouble(lot/stepvol,0);

   double minvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
   if(lot<minvol)
      lot=minvol;

   double maxvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX);
   if(lot>maxvol)
      lot=maxvol;
//--- return trading volume
   return(lot);
  }
//+------------------------------------------------------------------+
//| Check for open position conditions                               |
//+------------------------------------------------------------------+
void CheckForOpen(void)
  {
 
   MqlRates rt[2];
//--- go trading only for first ticks of new bar
   if(CopyRates(_Symbol,_Period,0,2,rt)!=2)
     {
      Print("CopyRates of ",_Symbol," failed, no history");
      return;
     }
    
 
//--- get current Moving Average
   double   ma[1];
   if(CopyBuffer(ExtHandle,0,0,1,ma)!=1)
     {
      Print("CopyBuffer from iMA failed, no data");
      return;
     }
//--- check signals
   ENUM_ORDER_TYPE signal=WRONG_VALUE;
  
   double filterma=iMA(_Symbol,_Period,MovingFilter,0,MODE_SMA,PRICE_CLOSE);

// buy
   double perc= ClosePerc;
   double add=perc*ma[0]/100;
   double maup=ma[0]+add;
   double mamid=ma[0];
   double madown=ma[0]-add;
  
  //Print(maup+"  "+mamid+"  "+madown);
   Comment(
   DoubleToString(maup,2)
   +"\n"+ DoubleToString(mamid,2)
   +"\n"+ DoubleToString(madown,2)
   );
  
  
  // trading for first tick of bar
      // if(rt[1].tick_volume>1)  return;
     
      //open Position due to condition
         //if(   rt[0].close> maup && rt[0].close>filterma ) 
         signal=ORDER_TYPE_BUY;  // buy conditions
        
     
//--- additional checking
   if(signal!=WRONG_VALUE)
     {
      if(TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) && Bars(_Symbol,_Period)>100){
         ExtTrade.PositionOpen(_Symbol,signal,TradeSizeOptimized(), SymbolInfoDouble(_Symbol,signal==ORDER_TYPE_SELL ? SYMBOL_BID:SYMBOL_ASK),  0,0);
                               Print("should Buy Now");}
     }
//---
  }
//+------------------------------------------------------------------+
//| Check for close position conditions                              |
//+------------------------------------------------------------------+
void CheckForClose(void)
  {
   MqlRates rt[2];
//--- go trading only for first ticks of new bar
   if(CopyRates(_Symbol,_Period,0,2,rt)!=2)
     {
      Print("CopyRates of ",_Symbol," failed, no history");
      return;
     }
   if(rt[1].tick_volume>1)
      return;
//--- get current Moving Average
   double   ma[1];
   if(CopyBuffer(ExtHandle,0,0,1,ma)!=1)
     {
      Print("CopyBuffer from iMA failed, no data");
      return;
     }
//--- positions already selected before
   bool signal=false;
   long type=PositionGetInteger(POSITION_TYPE);


// Close
   double perc= ClosePerc;
   double add=perc*ma[0]/100;
   double maup=ma[0]+add;
   double mamid=ma[0];
   double madown=ma[0]-add;

   if(type==(long)POSITION_TYPE_BUY && rt[0].close<madown)
      signal=true;
  
//--- additional checking
   if(signal)
     {
      if(TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) && Bars(_Symbol,_Period)>100)
         ExtTrade.PositionClose(_Symbol,3);
     }
//---
  }
//+------------------------------------------------------------------+
//| Position select depending on netting or hedging                  |
//+------------------------------------------------------------------+
bool SelectPosition()
  {
   bool res=false;
//--- check position in Hedging mode
   if(ExtHedging)
     {
      uint total=PositionsTotal();
      for(uint i=0; i<total; i++)
        {
         string position_symbol=PositionGetSymbol(i);
         if(_Symbol==position_symbol && MA_MAGIC==PositionGetInteger(POSITION_MAGIC))
           {
            res=true;
            break;
           }
        }
     }
//--- check position in Netting mode
   else
     {
      if(!PositionSelect(_Symbol))
         return(false);
      else
         return(PositionGetInteger(POSITION_MAGIC)==MA_MAGIC); //---check Magic number
     }
//--- result for Hedging mode
   return(res);
  }
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit(void)
  {  
//--- prepare trade class to control positions if hedging mode is active
   ExtHedging=((ENUM_ACCOUNT_MARGIN_MODE)AccountInfoInteger(ACCOUNT_MARGIN_MODE)==ACCOUNT_MARGIN_MODE_RETAIL_HEDGING);
   ExtTrade.SetExpertMagicNumber(MA_MAGIC);
   ExtTrade.SetMarginMode();
   ExtTrade.SetTypeFillingBySymbol(Symbol());
//--- Moving Average indicator
   ExtHandle=iMA(_Symbol,_Period,MovingPeriod,0,MODE_SMA,PRICE_CLOSE);
   if(ExtHandle==INVALID_HANDLE)
     {
      printf("Error creating MA indicator");
      return(INIT_FAILED);
     }
        if(SelectPosition())
      CheckForClose();
   else
      CheckForOpen();
//--- ok
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick(void)
  {
//---
   if(SelectPosition())
      CheckForClose();
   else
      CheckForOpen();
//---
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }
//+------------------------------------------------------------------+

 


Répondu

1
Développeur 1
Évaluation
(8)
Projets
15
7%
Arbitrage
4
25% / 50%
En retard
1
7%
Gratuit
Commandes similaires
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA. THREE TYPES OF ENTRIES 1: AGGRESSIVE 2: DIVERGENCE 3
Indicator in use: Bollinger Bands Mechanism (See diagrams provided for help) Sells: 1. Trigger candle: When candle low is above the top Bollinger band - accurate to the lowest point scale (e.g. On EURUSD if candle low is 1.07915 and the value of top bollinger is 1.07914 - this is a sell signal; or if on Futures if the increment is .25 or .10 then this is used) 2. Enter sell ONLY on the next candle if price breaks
Indicator in use: Bollinger Bands Mechanism: (See diagrams provided for help) Sells: 1. Trigger candle: When candle low is above the top Bollinger band - accurate to the point scale (e.g. On EURUSD if candle low is 1.07915 and the value of top bollinger is 1.07914 - this is a sell signal) 2. Enter sell ONLY on the next candle if price breaks below the trigger candle LOW (using the e.g. above- if next candle price
hey guys, im looking for an auto mt5 license system through a web app i have already, i simply want it so a unique license key is generated for memebers, they input this onto the EA input and then it checks if its valid. active license per user capped at 5. i already have an mt5 coder and dec team for the app so i dont know if youd prefer to intergrate onto the webapp yourself or simply provide the code and doc so my
I need a simple panel to execute both buy and sell operations with very basic things like stopp loss take profit that functions for both market orders such as buy stop sell stop buy limit sell limit I don't care about colors or design I just want how you can do it what interests me most are the functions
I want to create an EA that can take bids according to information of a logic I have developed to give indication of a BUY or SELL opportunity. The EA will then be able to activate the BUY at the lowest possible position once the indicator clears it for a BUY and take bid upwards or identify the highest point and clears it for a SELL and take bids downwards. As you can see from example of JULY 2024 data to see how
We are seeking a skilled developer who can convert a Tradingview indicator written in Pinescript to a NinjaTrader indicator written in C#. The goal is to create a profitable trading strategy using this indicator. The successful candidate will have expertise in both Pinescript and C# programming languages, as well as a strong understanding of trading indicators and strategies. The main responsibilities will include
I am seeking an experienced MQL5 developer to create a user-friendly manual Grid Trading Expert Advisor (EA) with the following key features: Dynamic Grid Trading: Adjustable Grid Distance: Traders can manually input grid distance in pips via an intuitive, movable table. Take Profit Management: Fixed TP for the initial positions (e.g., first 5 trades). Stop-Loss (Optional): Traders can choose to use a stop-loss with
I want have the possibility to increase lotsize not alone by Lot-multiplier rather I want add a fix-lot increase for excample for 0,05 lot. I want have this for buy / sell and hedge-buy and hedge sell
Develop EA to track performance metrics of strategies I would like to develop an EA that will track the performance metrics of the strategies I have running on a terminal, If any of the metrics start to under perform then the EA/Indictor should alert me with a pop up alert that specify's the metric that has triggered the alert. The EA should also display the metrics in a dashboard - please see my example screen shot

Informations sur le projet

Budget
30+ USD
TVA (19%): 5.7 USD
Total: 35.7 USD
Pour le développeur
27 USD
Délais
à 1 jour(s)