Forum

Help with function

Hi guys, I have a function(), but am struggling to see what's wrong. The function is supposed to close a trade after not stop lossing or taking profit in 10 days, but it's not running correctly since I have a trade running for more than 30 days in my EA when looking at the holding time scatter plot

Why am I getting a 0 Divide error?

if ( PositionsTotal ()== 0 &&Signal== "Buy" &&Longs== true &&HourAfter== true ) { double Balance = AccountInfoDouble ( ACCOUNT_BALANCE ); double RiskBuy = NormalizeDouble (( MathAbs (Ask - PriceInformation[ 2 ].low)*Multiplier), 2 ); //stop loss distance double AmountRisk = Balance * (