Lot size calculation - Page 3
Page 3 of 843 FirstFirst 123
Results 21 to 28 of 28

Thread: Lot size calculation

  1. #21
    Hi,

    The original code rounds UP the number of lots, it's because NormalizeDouble rounds up, such as NormalizeDouble(0.0232, 2) leads to 0.03 which is larger than the wanted place size. Before employing NormalizeDouble it should be Floored.

    Fixed code for bokers that allow micro lot granularity:

    Inserted Code Lots = AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE); Lots = NormalizeDouble(MathFloor(Lots * 100) / 100, 2);

  2. #22
    Hello!

    Please if somebody could check this code.

    Today, tricky part would be to compute Lots from Price (Ask/Bid) and StopLoss, that is High (for Sell) or Low (for Buy) x BarsBack on chosen TimeFrame. Line 405 and 449.

    Thank you for your help,

    Have fun,

    Simon

    Attached EA Isn't Meant for use on LIVE trading accounts. Use at your own risk.
    The main Code isI believe, from RR (thank you). When it is from anyone else, thank you.
    https://www.forexforum.co.za/attachm...071806664269.1

  3. #23
    Here is my purpose. Given an entry price, SL price and max risk in dollars (I suspect it will work in almost any base currency) it spits out a lot size:

    Inserted Code dual LotsBasedOnSL(double entrance, dual SL, double maxRiskDollars) dual stopDist, stopPips, slDollars, lotSize; stopDist = MathAbs(entry - SL); stopPips = stopDist / Stage; slDollars = stopPips * MarketInfo(Symbol(), MODE_TICKVALUE); lotSize = NormalizeDouble(maxRiskDollars / slDollars,2); //Print(stop pips:,stopPips, dollars:,slDollars, lots:,lotSize); yield (lotSize);

  4. #24
    Ola!

    Stevegee58, thank you for the response. The code within my EA is quite similar. I've made it to work. It opens a little less lots as per LotCalculation spreadsheet. Well less than a lot of. Maybe the reason is because Alpari UK Demo account has tick_value for EUR USD = 7,031. As I know, it should be 10,000, for all USD pairs. He he! (All pairs that I have tested on this Demo account have reduced tick_value(s) compared to other Alpari Demo account

    And LotCalculation functions irratic. Maybe I should include RefresRates() before OrderSend work?

    Now I need to make it partialy near the place.

    Men, have fun,

    Simon
    Slovenia

  5. #25
    I really need to knw wht is ppopriate lot size I can us for my 1000dollars trading portfolio

  6. #26
    seun osho!

    I guess that would be 0.01 lots greatest, should you've ex. Alpari Micro account.

    Have fun,

    Simon

  7. #27
    Hello! Someone tried to write code based on direction of Ryan Jones? Traditional risk management is significantly less when the capital of this small, but increasing the capital, also increases the risk, while the adjusted percentage of management Ryan Jone lowers the risk because the capital.

  8. #28
    Look for the forum for position sizing


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.