What is wrong in my code? Getting error 138 - page 3

 
Marco vd Heijden:
We can not help you.
and why not?
 

Because you are not showing the relevant code.

 
Marco vd Heijden:

Because you are not showing the relevant code.

Yes I am...?



I will repost what I have so far
 
void TradeCloser()
  { //start

   RefreshRates();
   int total=OrdersTotal();


   if((Second_Buy_Allowed=true) && (Second_Buy_Triggered=true))
     {
      if((Next_BUY_Order_Comment=="M1")) // compare the commenting
        {
         // do what you want.
         RefreshRates();
         OrderClose(Close1B(),Order0_Lot,Bid,2,Red);

        }
      if((Next_BUY_Order_Comment=="M2")) // compare the commenting
        {
         // do what you want.
         RefreshRates();
         OrderClose(Close2B(),Order1_Lot,Bid,2,Red);
        }
      if((Next_BUY_Order_Comment=="M3")) // compare the commenting
        {
         // do what you want.
         RefreshRates();
         OrderClose(Close3B(),Order2_Lot,Bid,2,Red);
        }
      if((Next_BUY_Order_Comment=="M4")) // compare the commenting
        {
         RefreshRates();
         OrderClose(Close4B(),Order3_Lot,Bid,2,Red);
        }

      if((Next_BUY_Order_Comment=="M5")) // compare the commenting
        {
         // do what you want.
         RefreshRates();
         OrderClose(Close5B(),Order4_Lot,Bid,2,Red);
        }
     }



   if((Second_Sell_Allowed=true) && (Second_Sell_Triggered=true))
     {
      if((Next_SELL_Order_Comment=="M1")) // compare the commenting
        {
         // do what you want.
         RefreshRates();

         OrderClose(Close1S(),Order0_Lot,Ask,2,Blue);

        }
      if((Next_SELL_Order_Comment=="M2")) // compare the commenting
        {
         // do what you want.
         RefreshRates();
         OrderClose(Close2S(),Order1_Lot,Ask,2,Blue);
        }
      if((Next_SELL_Order_Comment=="M3")) // compare the commenting
        {
         // do what you want.
         RefreshRates();
         OrderClose(Close3S(),Order2_Lot,Ask,2,Blue);
        }
      if((Next_SELL_Order_Comment=="M4")) // compare the commenting
        {
         RefreshRates();
         OrderClose(Close4S(),Order3_Lot,Ask,2,Blue);
        }

      if((Next_SELL_Order_Comment=="M5")) // compare the commenting
        {
         // do what you want.
         RefreshRates();
         OrderClose(Close5S(),Order4_Lot,Ask,2,Blue);
        }
     }

//end
  }
The problem is that it currently selects both the open buy and sell trade if there is already an open buy or sell trade. It should only select the trade (buy or sell) if the last trade moved -10 pips. Unless you have a better/cleaner way of doing this.
 
marth tanaka:
This will be my second time saying this. It is called in OnTimer() right before I open the next trade in the sequence

OK, I will ask for the first time, "Where is OnTimer() in your code"?

 
In all the code you have posted so far, there is not a single call to TradeCloser() function.
 
Marco vd Heijden:
In all the code you have posted so far, there is not a single call to TradeCloser() function.
That is because I am posting a function that I am trying to work on/need help with. Posting my OnTimer function is irrelevant to the subject..



@Keith Watford
 

This is ridiculous. 

This is like your car won't start, and you grab your spare Tyre and take it to the car garage and say to the guy at the counter, here is my spare Tyre my car won't start can you fix it ?

Then the guy at the counter asks "sure but where is your car ? "

And you respond, that's irrelevant...

 
Marco vd Heijden:

This is ridiculous. 

This is like your car won't start, and you grab your spare Tyre and take it to the car garage and say to the guy at the counter, here is my spare Tyre my car won't start can you fix it ?

Then the guy at the counter asks "sure but where is your car ? "

And you respond, that's irrelevant...

Really good joke. You truly made me chuckle at 6am my place but I don't think posting my OnTimer function is relevant whatsoever to this. I'm trying to create a function now that can check if the a trade moved negative 10 pips from the pool of current open trades and then return if it is a buy or sell trade. Then I can add it into the TradeCloser() function. No need for OnTimer() to be posted? Unless you can provide me a reason, not a metaphor?



The car starts ;) , I just have a flat tire that needs a little detailing.
 

Let me quote myself:

Marco vd Heijden, 2018.11.13 03:19

It can not be the TradeCloser() function because it is nowhere called.

Marco vd Heijden, 2018.11.13 10:36

Point me to the line where TradeCloser() is called.

Marco vd Heijden, 2018.11.13 13:21

Where is the call to TradeCloser() ?

Marco vd Heijden, 2018.11.13 13:25

Because you are not showing the relevant code.

Marco vd Heijden, 2018.11.13 13:28

In all the code you have posted so far, there is not a single call to TradeCloser() function.

The car doesn't start, it wasn't a joke.

The answer to your problem is very simple but if you do not post the relevant code, we can not help you.