I've done some research and I can't find a good way to do it, and I'm asking for help.
Print( " Ask: ", YSymbol.Ask( ) );
Print( " Bid: ", YSymbol.Bid( ) );
Print( " Profit: ", YPosition.Profit( ) );
Print( " Spread: ", ( YSymbol.Spread( ) * YSymbol.Point( ) ) );
Print( "Missing: ", ( -1 * YPosition.Profit( ) - YSymbol.Spread( ) * YSymbol.Point( ) ) );
Use the code above to display the following values
I'll appreciate any help with that.
I'm not sure whether I understand your question correctly. My understanding is that you are concerned about open positions which already exists before you start the EA?
If so, you would need to write code in the OnInit() function that evaluates all open positions and look at the current profit/loss of each position. Then you would need to set an allowable loss for each of these orders. This "allowable loss" could then be different for these already open positions compared to positions you will open from now on in OnTick().
then perhaps you need to calculate the lot size of the position based on a fixed amount you are accepting to lose - i think you can use something like lot = (amount)/(SLdistanceInPoints*tickValue) , and then normalize the value
If you read the first post, you'll see the data I'm using to make the calculations.
try using this equation
Please enable the necessary setting in your browser, otherwise you will not be able to log in.