var STATE_IDLE = 0;
var STATE_LONG = 1;
var STATE_SHORT = 2;
var State = STATE_IDLE;
function Trade(currentState, nextState) {
if (currentState === STATE_IDLE) {
if (nextState === STATE_LONG) {
exchange.SetDirection("buy");
AmountOP = InitAccount.Stocks * 10 / 2;
exchange.Buy(_C(exchange.GetTicker).Sell, AmountOP);
State = STATE_LONG;
}
后面还有其他条件判断执行,也会更改State的值,但为什么一直是0,不会变呢?