Пример #1
0
        public override void ReceiveTick(sTick pTick)
        {
            Spread = pTick.Ask - pTick.Bid;
            Tick   = pTick;

            DecisionFunction();
        }
Пример #2
0
        public static void TestAccount()
        {
            sTick    tick = new sTick();
            cAccount acct = new cAccount("M:1000.02; L:50; A:0.30;");

            // trailstop test

            tick.Bid = 1.1940;
            tick.Ask = 1.19415;

            acct.ReceiveTick(tick);
            acct.EnterTrade(1);
            acct.SetStop(0.0005);             // 5 pip stop
            acct.SetTakeProfit(0.0015);       // 15 pip take profit
            acct.SetTrailingStop(0.0003);     // 3 pip trailing stop

            tick.Bid = 1.1945;
            tick.Ask = 1.19465;
            acct.ReceiveTick(tick);             // tighten trailstop

            tick.Bid = 1.1943;
            tick.Ask = 1.19445;
            acct.ReceiveTick(tick);             // this should trigger trailstop

            // stop test

            tick.Bid = 1.1940;
            tick.Ask = 1.19415;

            acct.ReceiveTick(tick);
            acct.EnterTrade(1);
            acct.SetStop(0.0005);             // 5 pip stop
            acct.SetTakeProfit(0.0015);       // 15 pip take profit
            acct.SetTrailingStop(0.0003);     // 3 pip trailing stop

            tick.Bid = 1.1935;
            tick.Ask = 1.19365;

            acct.ReceiveTick(tick);             // this should trigger stop

            // take profit test

            tick.Bid = 1.1940;
            tick.Ask = 1.19415;

            acct.ReceiveTick(tick);
            acct.EnterTrade(1);
            acct.SetStop(0.0005);             // 5 pip stop
            acct.SetTakeProfit(0.0015);       // 15 pip take profit
            acct.SetTrailingStop(0.0003);     // 3 pip trailing stop

            tick.Bid = 1.19565;
            tick.Ask = 1.1957;

            acct.ReceiveTick(tick);             // this should trigger take profit
        }
Пример #3
0
 // TickServer calls all registered functions with new ticks
 // examples are: Account (high priority, called first)
 // Candlebuilders, Systems (like this)
 public override void ReceiveTick(sTick pTick)
 {
     spread = pTick.Ask - pTick.Bid;
     //cb10.ReceiveTick(pTick);	// register with TickServer or call here
 }
Пример #4
0
 public override void ReceiveTick(sTick pTick)
 {
     spread = pTick.Ask - pTick.Bid;
 }
Пример #5
0
 public override void ReceiveTick(sTick pTick)
 {
     Framework.Logger(99, "ERROR: ReceiveTick should never be called");
 }