Write your excel formula into a mql script.
https://www.mql5.com/en/docs/function_indices
AccountInfoDouble(ACCOUNT_EQUITY) and MessageBox() for the output.

- www.mql5.com
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
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?
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); }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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.