Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
969 B
1
Indexable
Never
if (!isInitialPhaseTriggered)
{
    isInitialPhaseTriggered = true;
    int orderTotal = OrdersTotal();
    if (orderTotal)
    {
        ulong OrderTicket = OrderGetTicket(0);
        open_price = OrderGetDouble(ORDER_PRICE_OPEN);
        volume = OrderGetDouble(ORDER_VOLUME_CURRENT) * 2;
        stop_loss = OrderGetDouble(ORDER_SL);
        take_profit = OrderGetDouble(ORDER_TP);
        string index = IntegerToString((int) open_price);
        next_order = config["phase_2"][index]["order"].ToStr();
        phase_level = 3;
        trade.OrderDelete(OrderTicket);
        int orderType = OrderGetInteger(ORDER_TYPE);
        if (orderType == ORDER_TYPE_BUY_STOP || orderType == ORDER_TYPE_SELL_STOP) // Check the order type before placing the order
        {
            type = orderType == ORDER_TYPE_BUY_STOP ? "buy" : "sell";
            placeOrder(volume, open_price, _Symbol, stop_loss, take_profit, "Phase 2 " + type, type);
        }
    }

    return;
}