[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 366

 
lottamer:


there are no ticks.

perhaps the lack of normalisation within the EA gives this effect.

However, when the input parameters tab appears, the optimization itself does not happen.

The tester does something, at the bottom you can see the current number of overshoots (7/62), but on completion in the tabs optimization results, and the optimization graph is Empty!

check mark on the parameter is of course ....

I don't even know which way to look...


The tester does not provide repeatable results with unchanged data, as the spread changes unknowingly when tested.

Cure:https://www.mql5.com/ru/forum/119830

 
Chiripaha:

Empty values may indicate that the result of optimising specific parameters is unprofitable - i.e. a drain. Try to run one of the parameters with Visualisation and you might see this result.

About normalisation, I don't think there will be such an effect either, because since the values are the same, the mathematical numbers will be exactly the same - hence no change.

As for "which way to think" - sometimes it's better not to think and put the question off - the idea and thoughts will come later. You have to give your brain room to manoeuvre, rest and think without straining.


1. the advisor is profitable.

2. I've already checked it by hand - it's profitable over the entire range of the parameter. I just wanted to widen the range a bit and make the step smaller.

 
tara:


The tester does not provide repeatable results with unchanged data, because the spread changes unknowingly during testing.

The cure:https://www.mql5.com/ru/forum/119830



The spread is floating, isn't it?

another thing is that it has to be cemented on history...

in general the result floats slightly and the number of trades does not change...so this issue does not scare me too much...

The other thing is that the optimizer doesn't work at all! This is annoying...

this is what the tester says in the log..:



2013.05.29 12:20:10 There were 8 passes done during optimization, 8 results have been discarded as insignificant

 
tara:


The tester does not provide repeatable results with unchanged data because the spread changes unknowingly during testing.

The cure:https://www.mql5.com/ru/forum/119830

It may be possible, but my spread size is put in Info - and when you change it, it shows up. On the tester I haven't noticed the spread floating. It takes the standard parameters data from MarketInfo of the current account and does not change it anymore.

This cure changes the spread p-r so that you can see different optimization results with different spreads. As I understand it, this is the only purpose for which the software at the link is needed.

 
lottamer:


2013.05.29 12:20:10 There were 8 passes done during optimization, 8 results have been discarded as insignificant

Well, that's right - These results have been discarded as insignificant. - That's why it doesn't show up in the results or in the graph.
 
Chiripaha:
Well, that's right - these results were marked as insignificant. - That's why it doesn't show up in the results or in the graph.



I think I have a deeper problem here.

My first question yesterday was how to optimise parameters inside a user function.

I was told: Move them to extern double

I did it.

and now the optimizer throws out the result... i must have moved them incorrectly.

Here's the code. It's a common modifier of stop and take

Instead of STOP and TAKE, there used to be numbers 100 and 200

I changed the numbers to STOP and TAKE

and at the beginning of the code I added

extern double STOP = 100;
extern double TAKE = 200;

Is there an error here somewhere?

(the modifier itself works 100%)

int My_modify()
 {
   bool   result;
   double take_profit,stop_loss,point;
   int    cmd,total,error;
//----
   total=OrdersTotal();
   point=MarketInfo(Symbol(),MODE_POINT);
//----
//   for(int i=0; i<total; i++)
//     {
      if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
        {
         //---- print selected order
         OrderPrint();
         cmd=OrderType();
         //---- buy or sell orders are considered
         if(cmd==OP_BUY || cmd==OP_SELL)
           {
            //---- modify first market order
            while(true)
              {
               if(cmd==OP_BUY) stop_loss=OrderOpenPrice()-STOP*point;
               else            stop_loss=OrderOpenPrice()+STOP*point;
               
                if(cmd==OP_BUY) take_profit=OrderOpenPrice()+TAKE*point;
                           else take_profit=OrderOpenPrice()-TAKE*point;
               
               
               result=OrderModify(OrderTicket(),0,stop_loss, take_profit,0,CLR_NONE);
               if(result!=TRUE) { error=GetLastError(); Print("LastError = ",error); }
               else error=0;
               if(error==135) RefreshRates();
               else break;
              }
             //---- print modified order (it still selected after modify)
             OrderPrint();
//            break;
           }
        }
      else { Print( "Error when order select ", GetLastError()); }
//     }
//----
   return(0);
  }
 

I'm looking at the code for now, but I'll allow a few comments along the way.

This line makes no sense at all:

point=MarketInfo(Symbol(),MODE_POINT);  /* поскольку это ровным счетом то же самое, что штатный параметр */ Point 

It will be needed only if you have a multi-currency strategy, but then, instead of a multi-currency strategy, you must use

Symbol()

You will need to use other predefined values, but not this normal function.

This variable is also unnecessary.

total=OrdersTotal();

Because inside your function it is applied only once, in enumeration, which is commented out for some reason, and it only clutters up the code. - Hence the question - Why did you comment out the enumeration by order?

This:

if(cmd==OP_BUY) stop_loss=OrderOpenPrice()-STOP*point;
else            stop_loss=OrderOpenPrice()+STOP*point;
               
if(cmd==OP_BUY) take_profit=OrderOpenPrice()+TAKE*point;
           else take_profit=OrderOpenPrice()-TAKE*point;

better grouped together in general - the condition is the same. By the way, you have written them differently by structure. - Is to the question of loss of structure. The style of writing must be uniform - then you can see the structure and possible errors will come out like bumps after the snowfall.

if(cmd==OP_BUY){ stop_loss   = OrderOpenPrice()-STOP*point;
                 take_profit = OrderOpenPrice()+TAKE*point; }

else           { stop_loss   = OrderOpenPrice()+STOP*point;
                 take_profit = OrderOpenPrice()-TAKE*point; }

From what you've presented I haven't found any principle points that may affect the result. But... You've only presented one function here (rather sloppily written, unless you count the commented enumeration - this is reflected in the question). To say the verdict - you don't need the function, you need the program code, because you don't know where and where the cause lies and you need to look for it. To do this, you must run the program in the tester and see with your own eyes the errors that may occur. Then already run through the code (or in reverse order) and look for the cause.

As a general feeling I can say that you, Oleg, have quite a few sloppinesses (indifference, I would say). This can lead to 1. To littering of the system in use. 2. Loss of structure as a result of this littering and difficulty in identifying and detecting the bug. So my advice is this. - If possible, throw out all the "trash" (excesses) from the code - the error will be easier to find. - This is a classic mistake of most people asking for help - carelessness.

 
lottamer:


It's probably deeper than that.

My first question yesterday was how to optimise parameters inside a custom function.

I was told: put them in extern double.

I did it.

And now the optimizer throws the result... apparently, I took them out somehow wrong.

No, I think you're wrong. The tester throws the result not because of the parameters we put out, but because the results don't pass the significance criterion.

But it's possible that the program itself might contain an error. Moreover, unstable results are an indirect indication of that. - It means that something is wrong. In my practice, I do not allow such programs to get to the real world. Because if something is wrong, it means that the situation is uncontrollable. And anything can come out.

The Stop-Loss and Take-Profit parameters, by definition, are in external variables in any program, and not only because they need to be optimized. It's not like you're going to go into your code every time you want to change them. So, it doesn't matter if it's external or internal variables. - That's for sure.

 
Chiripaha:

I'm looking at the code for now, but I'll allow a few comments along the way.

This line makes no sense at all:

You will only need it if you have a multi-currency strategy, but then instead of

You will need to substitute other predefined values, but not this basic function.

This variable is also unnecessary.

It is used only once inside the function in the enumeration, which is commented out for some reason and only clutters up the code. - Hence the question - Why did you comment out the enumeration by orders?

Here it is.

In general, it would be better to group them together - the condition is the same.

Well, I haven't found any principle points from what you've presented that may affect the result. But!... You've only presented one function here (rather sloppily written, unless you count the commented out enumeration - this is reflected in the question). To say the verdict - you don't need the function, you need the program code, because you don't know where and where the cause lies and you need to look for it. To do this, you must run the program in the tester and see with your own eyes the errors that may occur. Then already run through the code (or in reverse order) and look for this cause.

As a general feeling I can say that you, Oleg, have quite a lot of carelessness (indifference, I would say). This can lead to 1. To the littering of the system in use. 2. Loss of structure as a result of this littering and difficulty in identifying and detecting the bug. So my advice is this. - If possible, throw out all the "trash" (excesses) from the code - the error will be easier to find. - This is a classic mistake of most people asking for help - carelessness.


I did not write this modifier.

I got it ready from the libraries.

The main thing is that it's 100% working.

But why the parameter inside it is not optimized - that's the question.....

There are no basic errors!

The rest of the code works.

Put any conditions on the algorithm.

- buy

-modify

- close

---------------------------

and try to prooptimise the parameter inside my order MODIFICATOR - i.e. stop and take

 
Chiripaha:

No, I think you are wrong. The tester is not thrown out because of the parameters you put in, but because the results do not pass the significance criteria.

But it is possible that the software itself contains an error. Moreover, unstable results are an indirect indication of that. - It means that something is wrong. In my practice, I do not allow such programs to get to the real world. Because if something is wrong, it means that the situation is uncontrollable. And anything can come out.

The Stop-Loss and Take-Profit parameters, by definition, are in external variables in any program, and not only because they need to be optimized. It's not like you're going to go into the code every time you want to change them. So, it doesn't matter if it's external or internal variables. - That's for sure.

Well, look,

If I return everything back now, i.e. remove external STOP and TAKE parameters and write numbers inside the function instead of them, then the EA has been run week after week for 10 weeks and shows clear results.

If I manually change parameters of stop and takeoff, everything will work and give slightly different results (of course)

But now why, when I shift these parameters outside the modifier - the optimizer considers them insignificant?