input:bbuypoint(20,"買進點");

input:ssellpoint(18,"停損點");

input:profitpoint(25,"停利點");

input:position_qty(1,"部位");

 

 

if position = 0 and close <= bbuypoint and close > ssellpoint  then 

   begin

     //SetPosition(position_qty, MARKET); 

     print("1目前價位:",close);

     print("1成本價::",FilledAvgPrice);

     print("1停利價位:",profitpoint);

     print("1停損價位:",ssellpoint);

     print("1目前部位:",position);

print("1買進部位:",position_qty);

   end;

   

if position > 0 and close < ssellpoint then 

   begin

     print("2目前價位:",close);

     print("2成本價::",FilledAvgPrice);

     print("2停利價位:",profitpoint);

     print("2停損價位:",ssellpoint);

     print("2目前部位:",position);

//SetPosition(0, MARKET);

print("2停損賣出:");

   end;

if position > 0 and close > profitpoint then 

   begin

     print("3目前價位:",close);

     print("3成本價::",FilledAvgPrice);

     print("3停利價位:",profitpoint);

     print("3停損價位:",ssellpoint);

     print("3目前部位:",position);

//SetPosition(0, MARKET);

print("3停利賣出:");

   end;

print("0目前價位:",close);

print("0買進價位:",bbuypoint);

print("0成本價::",FilledAvgPrice);

print("0停利價位:",profitpoint);

print("0停損價位:",ssellpoint);

print("0目前部位:",position);

print("0停利賣出:");