One Click trading and automatic lot size

 
Is there a plugin to calculate the size of the position automatically using the One Click trading or an input via the keyboard (or from a signal)?

I manage multiple accounts with different risk, in each one I have to see the lot manually and it makes me lose a lot of time (I do it from an Excel spreadsheet where I have the balances and the leverage of the accounts.

Account 1: The size of the position is 10%
Account 2: The size of the position is 12%
Account 3: The size of the position is 14%

The only reason to have more accounts is to diversify the risk, nothing more, but it would be interesting, all the accounts have the same operations and they are closed and opened at the same time.

Is there a plugin already made for MT5 that allows this?
Or a robot that allows to open orders using HOT KEYS ?,

Or to be something like LOCAL signal provider?

Note: I do not need to calculate risk, stop, loss or take profit or anything, only size of position according to the balance.


I hope you can help me, very grateful and a greeting.
 

Write your excel formula into a mql script.

https://www.mql5.com/en/docs/function_indices

AccountInfoDouble(ACCOUNT_EQUITY) and MessageBox() for the output.

Documentation on MQL5: List of MQL5 Functions
Documentation on MQL5: List of MQL5 Functions
  • www.mql5.com
Reads from the file of the CSV type a string of one of the formats: "YYYY.MM.DD HH:MM:SS", "YYYY.MM.DD" or "HH:MM:SS" - and converts it into a datetime value
 

Sorry, So far I come, I do not know how to "convert equity" into a value to be able to operate it, I do not program it. :(

How do I make what comes out of "printf" be "equidad"?

Is "SCRIPT" (no indicator or expert)

void OnStart()

  {
double equidad;
 printf("ACCOUNT_EQUITY =  %G",AccountInfoDouble(ACCOUNT_EQUITY)); 
  }
 

I made it! Something I did finally nobody told me, I'm the best in the world jajaja

void OnStart()
{
double equidad;
double equidadmultiplicada;

equidad = AccountInfoDouble(ACCOUNT_EQUITY);
equidadmultiplicada = equidad*100;
printf(equidadmultiplicada);
return;
}

Now I will keep trying to try other things, if I do not mention it here to help me, thank you very much.

 

Ok, risk calculation ready. 

(I need to round the value that if). 

Can you make the value appear in the oneclick trading window? To not have to write it manually in the next operation?

Thank you very much

#property copyright ""
#property link      ""
#property version   "1.00"
#property indicator_chart_window
input int riesgo = 20;
input int valorlote = 100000;

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {


double lotaje;



lotaje = (((AccountInfoDouble(ACCOUNT_EQUITY))*riesgo)/valorlote); 


printf(lotaje);


   return(rates_total);
  }


 

Thank you very much for the help, for now I just want to execute an order through an SCRIPT, just that.

Okay, to start the treaty to open an operation through a SCRIPT, but I have not been successful, according to my broker (XM)  expert advisors is ON, I was using a DEMO account ZERO and change it to a normal, the same error in both.


The error is:

2018.11.07 03:13:46.181 Trades '25255221': failed market buy 0.10 EURUSD [Unsupported filling mode]

2018.11.07 03:13:46.181 buy (EURUSD,M1) retcode=10030  deal=0  order=0

2018.11.07 03:13:46.181 buy (EURUSD,M1) OrderSend error 4756


10030

TRADE_RETCODE_INVALID_FILL

Está especificado el tipo de ejecución de orden no válido


I'm trying to solve the problem, I do not have a lot of programming, the error that appears WANTS TO SAY that the order is REJECTED by the Broker? If you tell me "the type of order execution is not valid"? What is the valid method?

This script:


void OnStart()
  {
   MqlTradeRequest request={0};
   MqlTradeResult  result={0};

   request.action   =TRADE_ACTION_DEAL;                     
   request.symbol   =Symbol();                              
   request.volume   =0.1;                                   
   request.type     =ORDER_TYPE_BUY;                        
   request.price    =SymbolInfoDouble(Symbol(),SYMBOL_ASK); 
   request.deviation=5;                                     
   request.magic    =EXPERT_MAGIC;                          

   if(!OrderSend(request,result))
      PrintFormat("OrderSend error %d",GetLastError());     

   PrintFormat("retcode=%u  deal=%I64u  order=%I64u",result.retcode,result.deal,result.order);
  }

Thank you very much for the help, for now I just want to execute an order through an SCRIPT, just that.

 
I Just want to know when my auto treading will start?
 
simphiwe2:
I Just want to know when my auto treading will start?

What are you talking about and how does it relate to this topic?

 

I did it, I'm incredible haha.

This SCRIP is for the BUY and it automatically calculates the volume of the order with respect to a chosen percentage, for fixed percentage risk systems, the SCRIPT must be edited for each account according to the chosen risk, the leverage and the value of the lot. It gives faster to open orders when many accounts are handled because you only have to run the SCRIPT from the browser, you can even assign a keyboard shortcut. I corrected a critical error in the calculation of the size of the position (codes above were totally wrong in the calculation, it was corrected).

Forgive my English and greetings, thanks to the one who helped me at the beginning. 

input int riesgo = 20;
input int valorlote = 100000;
input int leverage = 400;

void OnStart()
  {

double lots;

lots = (((((AccountInfoDouble(ACCOUNT_BALANCE))*leverage)/100)*riesgo)/valorlote);

double lots2;

lots2 = (DoubleToString(lots,2));

   MqlTradeRequest request={0};
   MqlTradeResult  result={0};

   request.action   =TRADE_ACTION_DEAL;                     
   request.symbol   =Symbol();                             
   request.volume   =lots2;                               
   request.type     =ORDER_TYPE_BUY;   
   request.type_filling =ORDER_FILLING_IOC;                     
   request.price    =SymbolInfoDouble(Symbol(),SYMBOL_ASK);
   request.deviation=5;                                     

   if(!OrderSend(request,result))
      PrintFormat("OrderSend error %d",GetLastError());     

   PrintFormat("retcode=%u  deal=%I64u  order=%I64u",result.retcode,result.deal,result.order);
  }
  
Reason: