If no one will help here so go to Freelance -
----------------
Freelance
The forum
- What MQL5 developers think about the Freelance service
- MQL5.com Freelance: Developers' Source of Income (Infographic)
- Freelance, decompilation, the rules, examples of the decompiled code - the thread with examples
- Some new Freelance services (translation, consultation, converting) - the post.
- Freelance service new webdesign - the post
The articles
- How to implement traders' orders and make a profit in the MQL5 Freelance service
- Freelance Jobs on MQL5.com - Developer's Favorite Place
- MQL5.com Freelance: Developers' Source of Income (Infographic)
- Do Traders Need Services From Developers?
- A Few Tips for First-Time Customers
============
- In code:
Risk depends on your initial stop loss, lot size, and the value of the pair.
- You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
- Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
-
Do NOT use TickValue by itself - DeltaPerLot
and verify that MODE_TICKVALUE is returning a value in your deposit
currency, as promised by the documentation, or whether it is returning a value
in the instrument's base currency (EUR, in this case).
MODE_TICKVALUE is not reliable on non-fx instruments with many brokers. - You must normalize lots properly and check against min and max.
- You must also check FreeMargin to avoid stop out
- Use a EA GUI such as the one for MT4: Indicators: 'Money Manager Graphic Tool' indicator by 'takycard' Forum - Page 5
whroeder1:
- In code:
Risk depends on your initial stop loss, lot size, and the value of the pair.
- You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
- Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
-
Do NOT use TickValue by itself - DeltaPerLot
and verify that MODE_TICKVALUE is returning a value in your deposit
currency, as promised by the documentation, or whether it is returning a value
in the instrument's base currency (EUR, in this case).
MODE_TICKVALUE is not reliable on non-fx instruments with many brokers. - You must normalize lots properly and check against min and max.
- You must also check FreeMargin to avoid stop out
- Use a EA GUI such as the one for MT4: Indicators: 'Money Manager Graphic Tool' indicator by 'takycard' Forum - Page 5
I start with this but there is somethin wrong' cos doesn't work. void OnStart() { //--- } //+------------------------------------------------------------------+ extern double ExtMaximumRisk=0.025; // 5% by default //--- calculate current volume double CalculateVolume() { double lot_min =MarketInfo(Symbol(),MODE_MINLOT); double lot_max =MarketInfo(Symbol(),MODE_MAXLOT); double lot_step=MarketInfo(Symbol(),MODE_LOTSTEP); double contract=MarketInfo(Symbol(),MODE_LOTSIZE); double vol; //--- check data if(lot_min<0 || lot_max<=0.5 || lot_step<=0.0) { Print("CalculateVolume: invalid MarketInfo() results [",lot_min,",",lot_max,",",lot_step,"]"); return(0); } if(AccountLeverage()<=0) { Print("CalculateVolume: invalid AccountLeverage() [",AccountLeverage(),"]"); return(0); } //--- basic formula vol=NormalizeDouble(AccountFreeMargin()*ExtMaximumRisk*AccountLeverage()/contract,2); //--- additional calculation // ... //--- check min, max and step vol=NormalizeDouble(vol/lot_step,0)*lot_step; if(vol<lot_min) vol=lot_min; if(vol>lot_max) vol=lot_max; //--- return(vol); }
adriandd:
...
Forum on trading, automated trading systems and testing trading strategies
Hello,
Please EDIT your post and use the SRC button when you post code.
Thank you.
I start with this but there is somethin wrong' cos doesn't work. void OnStart() { //--- }
- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't
start, won't go in gear, no electrical, missing the key, flat tires -
meaningless.
We can't see your broken code.
There are no mind readers here and our crystal balls are cracked. -
Please don't add text inside quoted text or SRC blocks, put it outside.
MQL4 forum editor problem - MQL4 and MetaTrader 4 - MQL4 programming forum - Exactly what do you think that function does?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi
I need a script or indicator to set up the amount of lots. I mean, for example, set up for avoiding lots bigger than "1", or use lots whit risk more than 2%.
Thanks