Not logged in
Viewing 1 post (of 1 total)
  • #266917 |
    Participant
    1 Posts

    I want to interrupt the orders when the ea reaches a certain profit and I saw the code below in another message on the forum:

    double sqGetPLInPipsToday() {
    string todayTime = TimeToStr( TimeCurrent(), TIME_DATE);
    double plToday = 0;

    for(int i=0;i<OrdersHistoryTotal();i++) {
    if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true && OrderSymbol() == Symbol()) {

    if(OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELLSTOP) {
    // skip pending orders
    continue;
    }

    if(TimeToStr( OrderOpenTime(), TIME_DATE) == todayTime) {
    Log(“Comparing “, TimeToStr( OrderOpenTime(), TIME_DATE), ” = “, todayTime);
    if(OrderType() == OP_BUY) {
    plToday += OrderClosePrice() – OrderOpenPrice();
    } else {
    plToday += OrderOpenPrice() – OrderClosePrice();
    }
    }
    }
    }

    for (int cc = OrdersTotal() – 1; cc >= 0; cc–) {
    if (OrderSelect(cc, SELECT_BY_POS) && OrderSymbol() == Symbol()) {

    if(OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELLSTOP) {
    // skip pending orders
    continue;
    }

    if(TimeToStr( OrderOpenTime(), TIME_DATE) == todayTime) {
    if(OrderType() == OP_BUY) {
    plToday += sqGetBid(OrderSymbol()) – OrderOpenPrice();
    } else {
    plToday += OrderOpenPrice() – sqGetAsk(OrderSymbol());
    }
    }
    }
    }

    return (plToday*gPointPow);
    }

    However, when I try to insert the code below in the line of codes generated in AlgoWizard, I get the following error message:

    ‘gPointPow’ – undeclared identifier

    How do I fix this error? Do I need to add anything?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.