how to write code lotscalp():
double a = OrderLots()*((OrderStopLoss()-OrderOpenprice())*10000);
double b= lotscalp()*((Ask-OrderStopLoss())*10000);
a/b=1, how i must write to search value lotscalp?
Not sure what you are asking, but is this what you want?
double risk = ( OrderOpenPrice() - OrderStopLoss() ) * OrderLots(), delta = OrderClosePrice() - OrderStopLoss() , // Where OrderClosePrice() is current price of the open Order (Ask or Bid) lots = risk / delta ; // Lots for Scalp???
I would think
Yes, that is equivalent to my answer, but since "a/b" is a ratio, I removed the "10000" from the equations as the result will be the same and saves on computations.
Also, since I am assuming by "Ask" that the OP means the current price for the open order (Ask for a Sell, and Bid for a Buy), he can just use OrderClosePrice instead.
I also switched the ordering of the expression "OrderStopLoss()-OrderOpenprice()" so that the "a/b" ratio would automatically cancel out the signs and always return a positive value.
PS! You left out the parenthesis: "lotscalp = a/ ( (Ask-OrderStopLoss())*10000 ) ;"
I wasn't sure what he was asking, I just "changed sides" as you do in algebra. I don't know what happened to the parenthesis as I just cut and pasted basically. Weird!
i will write in math equations to be easily understood. Becasuse of my poor language.
idea it was like this.
Second and subsequent orders will not be open when AccountEquity () <AccountBalance ().
When the trailing stop moving stoploss above the open price. Then the value of the bid at the time it becomes a second order for OP_BUY.
The second stoploss and take profit should be identical to the first.
I need writing Lotscalp value () so that when the second order if to touch the stoploss value that has been moved to break even value. Because the first transaction gains and losses on the second transaction.