Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 18:19:13 +0000



Post From: Negative numbers

[2018-09-27 04:41:36]
User701453 - Posts: 176
I need some math coding assistance with determining when a negative number is greater then another negative number.
I reviewed this documentation, but found no examples for dealing with negative numbers.
http://www.sierrachart.com/index.php?page=doc/cpp_Operators.php

I`m trying to determine when open Profit/Loss is greater then the max lost

example:
double OPL = (PositionData.OpenProfitLoss / sc.CurrencyValuePerTick); //converted to ticks
double MaxL =-fabs(MaxLoss_Value.GetInt()); //40 ticks input converted to "-40"

If (OPL >= MaxL)//this is always returning true even if OPL is zero

{
// Do work here to close out the trade
}
Date Time Of Last Edit: 2018-09-27 05:06:10