+
1 5 5

: !!!

  1. #1

    01.09.2015
    30
    ()
    1
    0 () 0

    !!!

    , ....


    extern double Lots=0.02;
    extern int TakeProfit=30;
    extern int StopLoss=10;
    extern int Slippage=50;
    extern string comment="VWAP";
    extern int Magic=69;



    double SL, TP;
    int ticket;




    //| Expert initialization function |
    //+------------------------------------------------------------------+
    int init()
    {
    if (Digits == 3 || Digits == 5 )
    {
    TakeProfit *=10;
    StopLoss *=10;
    Slippage *=10;
    }
    return(0);
    }
    //+------------------------------------------------------------------+
    //| Expert deinitialization function |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
    {


    }
    //+------------------------------------------------------------------+
    //| Expert tick function |
    //+------------------------------------------------------------------+
    int start()
    {
    int v0 = iCustom (NULL, 0, "ClusterDelta_VWAP", 0, 1);


    Comment ("v0 = " + DoubleToString(v0));


    if (Bid < v0 && CountSell() == 0)
    {
    SL=NormalizeDouble(Bid + StopLoss * Point, Digits);
    TP=NormalizeDouble(Bid - TakeProfit * Point, Digits);

    ticket = OrderSend (Symbol(), OP_SELL, Lots, Bid, Slippage,0,0,comment,Magic,0);
    if (ticket > 0)
    {
    if (OrderSelect( ticket, SELECT_BY_TICKET, MODE_TRADES) == true)


    OrderModify( ticket, OrderOpenPrice(),SL, TP,0);

    }


    }
    if (Ask > v0 && CountBuy() == 0)
    {
    SL =NormalizeDouble (Ask - StopLoss * Point, Digits);
    TP = NormalizeDouble(Ask + TakeProfit * Point, Digits);


    ticket = OrderSend (Symbol(), OP_BUY, Lots, Ask, Slippage,0,0,comment,Magic,0);
    if (ticket > 0)
    {
    if (OrderSelect( ticket, SELECT_BY_TICKET, MODE_TRADES) == true)


    OrderModify(ticket, OrderOpenPrice(),SL, TP,0);

    }




    }
    return(0);
    }

    int CountSell()
    {
    int count = 0;
    for(int trade = OrdersTotal()-1; trade >= 0; trade--)
    {


    OrderSelect(trade, SELECT_BY_POS, MODE_TRADES);
    if(OrderSymbol()== Symbol() && OrderMagicNumber()==Magic)
    {
    if (OrderType()==OP_SELL)
    count++;
    }
    }
    return(count);
    }
    //-------------
    int CountBuy()
    {
    int count = 0;
    for(int trade = OrdersTotal()-1; trade >= 0; trade--)
    {


    OrderSelect(trade, SELECT_BY_POS, MODE_TRADES);
    if(OrderSymbol()== Symbol()&&OrderMagicNumber()==Magic)
    {
    if (OrderType()==OP_BUY)
    count++;
    }
    }
    return(count);
    }

  2. #2
    ClusterDelta.com Team   Ranc
    28.10.2011
    426
    ()
    153
    109 () 78
    ... ...

    clusterdelta.com - -

    ,

  3. #3

    01.09.2015
    30
    ()
    1
    0 () 0
    Ranc
    ! clusterdelta_vwap , 29 , forex_shift
    .. forex_shift )

  4. #4

    01.09.2015
    30
    ()
    1
    0 () 0
    return value of 'OrderModify' should be checked ? ?

  5. #5

    03.07.2018
    2
    ()
    0
    0 () 0
    ! ? ?

+

     

 

ClusterDelta.com - . : , , , http://clusterdelta.com http://forum.clusterdelta.com , , , .


, , . , , , .


(C) 2009-2012 ClusterDelta.com. .

 

@Mail.ru