[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

query current stop value in strategy



PureBytes Links

Trading Reference Links

Is there a 2000i function or reserved word that will return the value of the
current stop price in a strategy signal? The BE stop order is properly
generated in Tracking Center, so it seems like that information should be
available without additional computations.

The goal is to provide ShowLongStop() or ShowShortStop() with an argument
that will plot the current stop price, which may change from one bar to the
next due to the use of SetBreakEven().

Currently I'm using:

    Inputs: stop_$(50), profit_$(500), BE_fraction(0.3)
    SetStopPosition;
    SetStopLoss(stop_$);
    SetBreakEven( BE_fraction * value1 * profit_$ );
    ...
    ShowLongStop( AvgEntryPrice - stop_$/CurrentContracts );

which works properly under all conditions until the profit level moves the
stop to BreakEven. I could use a conditional variable in place of
stop_$/CurrentContracts that will be zero when the SetBreakEven() threshold
is reached, such as:

    ShowLongStop( AvgEntryPrice -
      iff( MaxPositionProfit >= BE_fraction * value1 * profit_$,
        0, stop_$/CurrentContracts
      )
    );

but I'm hoping that someone knows of a 2000i native function or reserved
word that returns the value of the current stop price as indicated in the
Active Orders tab of the Tracking Center.