New MT4 broker. Lot size calculation 10 times larger than previous broker for certain instruments

New MT4 broker. Lot size calculation 10 times larger than previous broker for certain instruments

Manage alerts

Loading saved threads...

kashix9 · External communityPost link
External question — Stack Overflow Stack Exchange Author: kashix9 Original post: https://stackoverflow.com/questions/77348132 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. This code has worked for me automating the calculating of lot size until I started using a new broker. Trading using this code on the new broker opens a position 10 times larger. If I wanted to risk $500, it will risk $5000 instead. I'm sure it's something simple but I can't figure it out right now. Does anyone have any ideas on what could be the issue? Point value and Tick value is the same. This code calculates the correct lot size for every instrument except NSDQ and SPY, where it's 10 times the size. What could the problem be? riskticks=MathAbs(myEntry-mySL)/SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_SIZE); tickvalue=SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE); riskcash=currBet; lotsize=riskcash/(riskticks*tickvalue); lotsize_1=NormalizeDouble(lotsize*(input_takePartialsPercent*.01),2); mySL = NormalizeDouble(mySL,digits); myEntry = NormalizeDouble(myEntry,digits); myTP = NormalizeDouble(myTP,digits);
Quote
Report
Mark SdS · External communityPost link
External answer — Stack Overflow Stack Exchange Author: Mark SdS Original post: https://stackoverflow.com/a/77354671 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Just add /10 at lotsize=riskcash/(riskticks*tickvalue) ?
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: kashix9 Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/questions/77348132 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. This code has worked for me automating the calculating of lot size until I started using a new broker. Trading using this code on the new broker opens a position 10 times larger. If I wanted to risk $500, it will risk $5000 instead. I'm sure it's something simple but I can't figure it out right now. Does anyone have any ideas on what could be the issue? Point value and Tick value is the same. This code calculates the correct lot size for every instrument except NSDQ and SPY, where it's 10 times the size. What could the problem be? riskticks=MathAbs(myEntry-mySL)/SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_SIZE); tickvalue=SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE); riskcash=currBet; lotsize=riskcash/(riskticks*tickvalue); lotsize_1=NormalizeDouble(lotsize*(input_takePartialsPercent*.01),2); mySL = NormalizeDouble(mySL,digits); myEntry = NormalizeDouble(myEntry,digits); myTP = NormalizeDouble(myTP,digits);

Cancel quote

Checking account access…