i wrote a different script that prints out much of the data for usdjpy on my aud account.
The 0.35 in the code is my common tradesize, albeit i want other trades with different sizes -- to have sl that is equivalent of $350 ie if my trade is 0.14, then my sl target will be roughly 2.5X the distance from open price as on the larger 0.35 trade.
Here is the output of that script. supporting my calc result is 875 points for the 0.35 trade. i have also supported this by using myfxbook calculator and got same result of 87.5 pips.

Why not ask AI tools? For experienced developers, AI can be helpful. I sometimes put my hand written code into AI and get it to do a code review for me.
Conor Mcnamara #:
Why not ask AI tools? For experienced developers, AI can be helpful. I sometimes put my hand written code into AI and get it to do a code review for me.
i just havent made the time to explore that much. and like they say bout "old dogs" and "new tricks".
Why not ask AI tools? For experienced developers, AI can be helpful. I sometimes put my hand written code into AI and get it to do a code review for me.
Michael Charles Schefe #: NOTE by "Not working" i mean i get Invalid stops errors. These sell trades do not have a sl on them.
Always, before sending an order to modify a position, you need to check the stop levels. Here's an example:
//+--------------------------------------------------------------------------------------------------------------------+ //| Check stop levels //+--------------------------------------------------------------------------------------------------------------------+ bool CheckStopsLevel(string symbol, ENUM_ORDER_TYPE type, double sl, double tp) { if(g_cache.stopsLevel == 0) return true; double price = (type == ORDER_TYPE_BUY) ? g_cache.bid : g_cache.ask; double minDistance = g_cache.stopsLevel * g_cache.point; if(type == ORDER_TYPE_BUY) { if(price - sl <= minDistance) return false; if(tp - price <= minDistance) return false; } else { if(sl - price <= minDistance) return false; if(price - tp <= minDistance) return false; } return true; }
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
gidday. i want my script to work on forex pairs, all trades, from all forec symbols. My script below is working on both usd and aud deposit accounts, but only on BUY TRADES. help!
I want all my trades have an sl that is equivalent of $350.