Download MetaTrader 5
To add comments, please log in or register
Having difficulties in understanding the Trading Signals service? Read the article!
Carl Schreiber
5939
Carl Schreiber 2014.03.05 18:59 

Again more problems :(

This sweet little snippet of code would kill my complete existence:

void OnTick()
  {
//---
        static bool isSell = false;
        if ( !isSell && TimeCurrent() >=  D'2013.01.25 09:03:42' ) {
                ResetLastError();
        Print("Befor placeLimSTP ",TimeToStr(TimeCurrent(),TIME_SECONDS)+" Digits for ",Symbol(),": ",Digits,
              "  Ask: "+DoubleToStr(Ask,Digits)+"  Bid: "+DoubleToStr(Bid,Digits)+"  Sprd: "+DoubleToStr((Ask-Bid)/Point,0),
                        DoubleToStr(MarketInfo("EURUSD",MODE_STOPLEVEL),0));
        OrderSend(Symbol(),OP_SELLLIMIT,1.0,0.85062,10,0.85162,0.84862,"WOWa",1,0,Red);
        OrderSend(Symbol(),OP_BUYSTOP,  1.0,0.85062,10,0.84862,0.85262,"WOWb",1,0,Lime);
        isSell = true;
        }
  }

This is how the chart looks:


And this is what is printed in the Journal-Tab:

2014.03.05 19:54:02.431 EURGBP,M1: 546410 tick events (2541855 bars, 24929032 bar states) processed within 38033 ms (total time 38672 ms)
2014.03.05 19:54:02.431 2013.01.25 09:30  Tester: order #1 is closed
2014.03.05 19:54:02.431 2013.01.25 09:30  Booom: stopped because of Stop Out
2014.03.05 19:54:02.431 2013.01.25 09:30  Tester: pending order is deleted [no enough money]
2014.03.05 19:54:02.431 2013.01.25 09:30  Tester: PrevBalance: 10000.00, PrevPL: -168000000020.07, PrevEquity -167999990020.07, PrevMargin: 1373.56, NewMargin: 1374, FreeMargin: -167999991393.63
2014.03.05 19:54:02.431 2013.01.25 09:30  Tester: not enough money for buy 1.00 EURGBP at 0.85062 sl: 0.84862 tp: 0.85262 [2013.01.25 09:30]
2014.03.05 19:54:02.431 2013.01.25 09:30  Tester: order #1, sell 1.00 EURGBP is opened at 0.85062
2014.03.05 19:53:29.161 2013.01.25 09:03  Booom EURGBP,M1: open #2 buy stop 1.00 EURGBP at 0.85062 sl: 0.84862 tp: 0.85262 ok
2014.03.05 19:53:29.161 2013.01.25 09:03  Booom EURGBP,M1: open #1 sell limit 1.00 EURGBP at 0.85062 sl: 0.85162 tp: 0.84862 ok
2014.03.05 19:53:29.151 2013.01.25 09:03  Booom EURGBP,M1: Befor placeLimSTP 09:03:42 Digits for EURGBP: 5  Ask: 0.84920  Bid: 0.84910  Sprd: 100
2014.03.05 19:53:24.391 Booom test started

Really strange!

The first time this loss appears was with a Buy-Stop at this price (a Sell-Stop was place below the open of this bar).

REALLY Today I am struggling ONLY with things that do not work! The whole Ash-Wednesday wasted!


Gooly

Carl Schreiber
5939
Carl Schreiber 2014.03.05 19:19  

This is the result placing only a buy stop:

1       2013.01.25 09:03        buy stop        1       1.00    0.85062 0.84862 0.85262 0.00    10000.00
2       2013.01.25 09:30        buy     1       1.00    0.85062 0.84862 0.85262 0.00    10000.00
3       2013.01.25 09:30        close at stop   1       1.00    0.85064 0.84862 0.85262 -167999999996.65        -167999989996.65

and this is the result of only sell:

1       2013.01.25 09:30        sell    1       1.00    0.85064 0.85262 0.84862 0.00    10000.00
2       2013.01.25 09:30        close at stop   1       1.00    0.85079 0.85262 0.84862 -168000000025.09        -167999990025.09

In the Journal-Tab:
2014.03.05 20:24:33.649 EURGBP,M1: 546411 tick events (2541855 bars, 24929032 bar states) processed within 9812 ms (total time 10421 ms)
2014.03.05 20:24:33.649 2013.01.25 09:30  Tester: order #1 is closed
2014.03.05 20:24:33.649 2013.01.25 09:30  Booom: stopped because of Stop Out
2014.03.05 20:24:33.649 2013.01.25 09:30  Booom EURGBP,M1: After placeOrder 09:30:01 Digits for EURGBP: 5  Ask: 0.85074  Bid: 0.85064  Sprd: 10
2014.03.05 20:24:33.649 2013.01.25 09:30  Booom EURGBP,M1: open #1 sell 1.00 EURGBP at 0.85064 sl: 0.85262 tp: 0.84862 ok
2014.03.05 20:24:33.649 2013.01.25 09:30  Booom EURGBP,M1: Befor placeOrder 09:30:01 Digits for EURGBP: 5  Ask: 0.85074  Bid: 0.85064  Sprd: 10
2014.03.05 20:24:33.649 2013.01.25 09:30  Booom EURGBP,M1: After placeOrder 09:30:00 Digits for EURGBP: 5  Ask: 0.85061  Bid: 0.85051  Sprd: 10
2014.03.05 20:24:33.649 2013.01.25 09:30  Booom EURGBP,M1: Befor placeOrder 09:30:00 Digits for EURGBP: 5  Ask: 0.85061  Bid: 0.85051  Sprd: 10
2014.03.05 20:24:23.839 Booom test started

the sweet little snippet;

 if ( !isSell && TimeCurrent() >=  D'2013.01.25 09:29:00' && Bid >= 0.8502 ) {
        ResetLastError();
        Print("Befor placeOrder ",TimeToStr(TimeCurrent(),TIME_SECONDS)+" Digits for ",Symbol(),": ",Digits,
              "  Ask: "+DoubleToStr(Ask,Digits)+"  Bid: "+DoubleToStr(Bid,Digits)+"  Sprd: "+DoubleToStr((Ask-Bid)/Point,0));
           if ( Bid >= 0.85060 ) {
                OrderSend(Symbol(),OP_SELL,1.0,Bid,10,0.85262,0.84862,"WOWc",1,0,Yellow);
                isSell = true;
           }
        Print("After placeOrder ",TimeToStr(TimeCurrent(),TIME_SECONDS)+" Digits for ",Symbol(),": ",Digits,
               "  Ask: "+DoubleToStr(Ask,Digits)+"  Bid: "+DoubleToStr(Bid,Digits)+"  Sprd: "+DoubleToStr((Ask-Bid)/Point,0));
   }


The very sad thing is - it is only and always in favour of the broker :(((

Gooly

/
To add comments, please log in or register