# Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 208

T-G:

Hello all. Need some help.

In my board opens a series of orders, in the amount set by MaxOrders parameter, below I have indicated how it looks like for example, don't judge strictly by lots

1-Lot order = 128

2-Lot order=256

3-lot-order-lot=512

4-lot-order-lot=1024

5-order-lot=2048

This is all for the tester.

MaxOrders=5, and 5 orders are open. The problem is that in the Strategy Tester my broker has a limit of 1000 lots and therefore 4 and 5 orders will not open as I should.

I searched through the Internet looking for a way to change this parameter in the Strategy Tester, I failed to find out how to do it.

Thus, I have decided to solve this issue using programming. I have decided to open several orders for 4 orders and get two

4-order-lot=1000

4-order-lot=24

for 5 orders 3:

5-order-lot=1000

5-order-lot=1000

5-order-lot=48

but there are two problems here,

- how to correctly break the MM so that it would be broken down into lots according to the max lot

- And how to open additional orders without breaking the order, i.e. there will be more orders than in the MaxOrders, but not to count additional orders which are opened to meet the volume.

Perhaps we should split the lots, i.e. open several positions which are connected with each other with comments where the parent and child orders' tickers are placed. The parent order with the volume of 1000 will have a ticket of the order with the volume of 24, and the child order with the volume of 1000 will have a ticket in this order. And we will have to close, modify them in the same way... Or simpler - a micro account and very small lots. In calculations for visual tracking multiply lots by coefficient, so that they take the value you need...

Nothing else comes to mind, except a brokerage company that allows larger volumes.

Or... divide by 100 your lots

artmedia70:

You don't have to be an expert in Boolean algebra to state the conditions clearly...

Let me make life a little easier for you... Replace if with the usual if, else with otherwise, && with and, || with or , etc... Then you will be able to read in your own normal words what is written or decide what you want to write.

What you have written (let's skip the wrong condition description for now):

1. if (ot==0) If there are no market orders (neither market orders at all, nor pending ones, nor open by this EA, or by another EA, or manually)... If yes, then line 2 is executed, if no, then we go to line 3.

2. if (Bid==Price) If the price is equal to the opening price of the current candle... If it is, then line 3 is executed, if not, then we go to line 4.

3. if(((Open[1]-Close[1])>100*Point)&&((Open[1]-Close[1])<120*Point)) If the open price of the first candle is higher than the close price of the first candle by more than 100 points and less than 120 points... If it is, go to line 4, if not, go to line 5.

4. if(((High[1]-Open[1])>40*Point)&&((High[1]-Open[1])<60*Point)) If the high of the first candle is higher than the open price of the first candle by more than 40 points and less than 60 points... If it is, then we execute line 5, if not, we go to line 6.

5. if(((Close[1]-Low[1])>40*Point)&&((Close[1]-Low[1])<60*Point)) If the close of the first candle is higher than the low of the first candle by more than 40 points and less than 60 points. If it is, then line 6 is executed, if not, go to line 7.

6.

7.

As you can see from this decomposition, you either have all lines of code executed one after another (in case each line returns true), or you skip the line that comes after the line that returns false.

To avoid confusion about your conditions and to get the logic right, enclose all statements in curly braces, regardless of whether a single line should be executed after the truth value, or an entire block.

For example:

So, try to decompose your code into components, removing extra brackets, which are unnecessary in this case...

solnce600:
It turns out that when I was accused of lack of Boolean logic - they meant extra brackets in operators.... but these are formatting rules for expressions and operators.... is this Boolean logic?

No - absence of curly brackets where they are necessary. Applying to the candlestick size search logic block in your EA

solnce600:

I have corrected your code, so that it still monitored closing by stop - I have assigned a value to the magician for you. I did not check it myself.

The deals are opened on the hourly timeframe under certain conditions, but we need to make it so that the deals were opened only under the conditions on the 4-hour chart.

For example: If on the hourly chart crossover averages open a deal, provided that the 4-hour chart with the averages with other parameters crossed in the same direction. I would be grateful for answers, and help.

teplovoz:

The deals are opened on the hourly timeframe under certain conditions, but we need to make it so that the deals were opened only under the conditions on the 4-hour chart.

For example: If on the hourly chart crossover averages open a deal, provided that the 4-hour chart with the averages with other parameters crossed in the same direction. I would be grateful for answers, and help.

Applies to the MAs to obtain data from H4 for the first and second bars:

```double MA1_H4=iMA(Symbol(),PERIOD_H4,ma_period,ma_shift,ma_method,appled_price,1);
double MA2_H4=iMA(Symbol(),PERIOD_H4,ma_period,ma_shift,ma_method,appled_price,2);```

To obtain data from H1 for the first and second bars:

```double MA1_H1=iMA(Symbol(),PERIOD_H1,ma_period,ma_shift,ma_method,appled_price,1);
double MA2_H1=iMA(Symbol(),PERIOD_H1,ma_period,ma_shift,ma_method,appled_price,2);```

Do the same for other periods and indicators.

artmedia70:

Apply to the MAs for H4 data for the first and second bars:

Do the same for other periods and indicators.

Wow. I'm so dumb, I guess I just need to specify the required timeframe in the wizards parameters and that's it? Thanks, my brain refuses to work these days :)

artmedia70:
I corrected your code so that it would still track the stop closure - I assigned a value to the magician for you. I did not check it myself.

I'll do it again. Thank you very much.

It's all right, we all have them once in a while...

artmedia70:

Well, you need to understand the main condition that is true all the time, over a period of time. For example - a time comparison. After issuing all the alerts, you need to assign a new value to the variable with which you are comparing the current time. Look for a function that defines a new bar. The concept of its construction should help you.