Beispiel #1
0
 protected override double exitLevel()
 {
     Bomb.when(position.isClosed(), () => "position closed without cleaning up parabolic stop!");
     if (numBars == 0)
     {
         return(initialStopPrice);
     }
     if (maxExtreme.changed())
     {
         af.set(Math.Min(af[1] + afStep, afMax));
     }
     return(capped(this[1] + af * (extreme - this[1])));
 }
Beispiel #2
0
 void trade()
 {
     if (highest.changed())
     {
         if (hasPosition())
         {
             return;
         }
         placeOrder(symbol.buy("enter long", stop(highest), 100, fillOrKill()));
     }
     else if (hasPosition())
     {
         placeOrder(position().exit("exit long", market(), fillOrKill()));
         placeOrder(position().exit("exit long 2", market(), fillOrKill()));
     }
 }