[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 432

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
Can you tell me if the Sleep command does not seem to work at all, or should it be replaced by something else?
HI Great people, Please, i would like to ask direction on writing this final snippet to complete my bot, these are my achievements so far :
1. i have included a helper function that calculates the exact lot that risk a specific amount (in this case its 1% per trade), for a $10,000 account that should be $100 per trade
2. i place a trade using a breakout strategy and obviously only risk 1% each time thanks to the above function , but there is one small dilemma;
sometimes the price breaks through but can't quite hit the TP which is set by me arbitrarily, I was wondering if there is a way to close as much of the running trade as possible,
so for example;
since we are only risking $100 per trade,
if we have a BUY trade with a TP set at 100pts,
and my function above accurately calculated we need to place 1lots to make $100 at 100pts,
and SL set at the same 100pts so 1:1 RR,
how can one close out 10$ partially after every 10 point increase in price towards my TP,
figuring out exactly how much out of the 1lot to partially close out each time is extremely tricky because remember the distance from the point the trade was taken increases as price gets closer to the TP in this example
e.g
at 10 points from the BUY price we need to close out x amount of lots ,
at 20 points from the BUY price we need to close out y amount of lots ,
at 30 points from the BUY price we need to close out z amount of lots ,
...and so on until we reach 90points
at which point if we add all the lot we closed it should still equal 1lot which is what we placed the trade with
MANY THANKS!