public double firstPastAsk(int rowIn)
{
...
System.out.println(trajectory(rowIn) + " " + primary(rowIn) + " " + finalAction(rowIn));
return pastPrice;
}
String action = " ";
public String finalAction(int rowIn)
{
action = "[" + primary(rowIn) + "]";
return action ;
}
boolean buyFlag = false;
public String primary(int rowIn)
{
String Request = "initial";
if(trajectory(rowIn) == "BUY")
{
if(buyFlag == false)
{
buyFlag = true;
Request = "REQUEST BUY";
}
}
if(trajectory(rowIn) == "SELL")
{
buyFlag = false;
Request = "REQUEST SELL";
}
return Request;
}
输出结果:
TRAJECTORY: PRIMARY: FINAL ACTION:
WAITING ON SUFFICIENT DATA initial [initial]
(BUY) REQUEST BUY [initial]
initial [initial]
(SELL) REQUEST SELL [REQUEST SELL]
initial [initial]
(BUY) REQUEST BUY [initial]
(SELL) REQUEST SELL [REQUEST SELL]
(BUY) REQUEST BUY [initial]
使用上面的代码,当“finalAction”被调用,随后调用“primary”时,它接收“REQUEST SELL”和“initial”的返回值,但从不接收“REQUEST BUY”的值。我无法理解为什么“finalAction”总是收到“initial”而不是“REQUEST BUY”,但收到“REQUEST SELL”。
一只斗牛犬
相关分类