Can someone please help me correct the parenthesis and return

 
extern double PB1=104000; // Buy price of Phase 1
extern double OS1=0.01; // Order size of Phase 1
extern double TP1=100; // Take Profit of Phase 1
extern double PBDip1=100; // Dip Level for new buy in Phase 1
extern double CL=10/100; // Cut Loss level

extern double PB2=103000; // Buy price of Phase 2
extern double OS2=0.01; // Order size of Phase 2
extern double TP2=100; // Take Profit of Phase 2
extern double PBDip2=100; // Dip Level for new buy in Phase 2

extern double PB3=104000; // Buy price of Phase 3
extern double OS3=0.01; // Order size of Phase 3
extern double TP3=100; // Take Profit of Phase 3
extern double PBDip3=100; // Dip Level for new buy in Phase 3

//+------------------------------------------------------------------+
//| Code Start                                                       |
//+------------------------------------------------------------------+ 
int start()
   {
    while(PB1>Ask)
      {
      if (Ask<(PB1-PBDip1))break;
         for (int x=0; x <= OrdersTotal(); x++)
         {
           OrderSelect(x,SELECT_BY_POS,MODE_TRADES);
            if ((PB1-PBDip1) <= OrderOpenPrice && OrderOpenPrice <= PB1)
            {
            continue;
            }
         else
            {OrderSend (Symbol(),OP_BUY,Ask*Point,Ask,50*Point,0,Ask+TP1*Point);
               continue;
            }
         }
      
   return 0;
      }
     return 0;
   }

I am fairly new and this is the first code i am trying to write, would appreciate any advice. Thanks

 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.
 
Brock Lee: I am fairly new and this is the first code i am trying to write, would appreciate any advice. Thanks
  1. int start()

    You should stop using the old event handlers and IndicatorCounted() and start using new event handlers.
              Event Handling Functions - MQL4 Reference
              How to do your lookbacks correctly - MQL4 programming forum #9-14 & #19 2016.05.11

  2.         for (int x=0; x <= OrdersTotal(); x++){
               OrderSelect(x,SELECT_BY_POS,MODE_TRADES);
    If there are n orders, their positions are [0 … n-1] yet you try to select n which fails, but you don't check your return code and try to process anyway.
              What are Function return values ? How do I use them ? - MQL4 programming forum 2012.05.20
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 25 March 2014

  3. Why are you selecting orders and then doing nothing with them? Do you really want to open a new order n times?

  4. Your code
    Documentation
    OrderSend (
    Symbol(),
    OP_BUY,
    Ask*Point,
    Ask,
    50*Point,
    0,
    Ask+TP1*Point
    
    
    
    );

    int  OrderSend(
       string   symbol,              // symbol
       int      cmd,                 // operation
       double   volume,              // volume
       double   price,               // price
       int      slippage,            // slippage
       double   stoploss,            // stop loss
       double   takeprofit,          // take profit
       string   comment=NULL,        // comment
       int      magic=0,             // magic number
       datetime expiration=0,        // pending order expiration
       color    arrow_color=clrNONE  // color
       );
  5. You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.

    1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?

    2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
                MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25

    3. The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
      Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).

  6. Ask*Point is meaningless. Risk depends on your initial stop loss, lot size, and the value of the symbol. It does not depend on margin and leverage. No SL means you have infinite risk. Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% total.

    1. You place the stop where it needs to be — where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.

    2. AccountBalance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the spread, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)

    3. Do NOT use TickValue by itself - DeltaPerLot and verify that MODE_TICKVALUE is returning a value in your deposit currency, as promised by the documentation, or whether it is returning a value in the instrument's base currency.
                MODE_TICKVALUE is not reliable on non-fx instruments with many brokers - MQL4 programming forum 2017.10.10
                Is there an universal solution for Tick value? - Currency Pairs - General - MQL5 programming forum 2018.02.11
                Lot value calculation off by a factor of 100 - MQL5 programming forum 2019.07.19

    4. You must normalize lots properly and check against min and max.

    5. You must also check FreeMargin to avoid stop out

    Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5 or 0.1 Lots maximum.

 
Brock Lee:

I am fairly new and this is the first code i am trying to write, would appreciate any advice. Thanks

 extern double PB1=104000; // Buy price of Phase 1
extern double OS1=0.01; // Order size of Phase 1
extern double TP1=100; // Take Profit of Phase 1
extern double PBDip1=100; // Dip Level for new buy in Phase 1
extern double CL=10/100; // Cut Loss level

extern double PB2=103000; // Buy price of Phase 2
extern double OS2=0.01; // Order size of Phase 2
extern double TP2=100; // Take Profit of Phase 2
extern double PBDip2=100; // Dip Level for new buy in Phase 2

extern double PB3=104000; // Buy price of Phase 3
extern double OS3=0.01; // Order size of Phase 3
extern double TP3=100; // Take Profit of Phase 3
extern double PBDip3=100; // Dip Level for new buy in Phase 3
  int start()
   {
   bool OrderResult;
    while(PB1>Ask)
      {
      if (Ask<(PB1-PBDip1))break;
         for (int x=0; x <= OrdersTotal(); x++)
         {
          OrderResult=OrderSelect(x,SELECT_BY_POS,MODE_TRADES);
            if ((PB1-PBDip1) <= OrderOpenPrice() && OrderOpenPrice() <= PB1)
            {
            continue;
            }
         else
            {OrderResult=OrderSend (Symbol(),OP_BUY,Ask*Point,Ask,50*Point,0,Ask+TP1*Point);
               continue;
            }
         }
      
   return 0;
      }
     return 0;
   }
Reason: