And let's make a "cartoon" out of it (multicurrency) - page 8

 
ALex2008 >> :

What exactly is unclear? It is zero when entering the function. Maybe I don't understand....


//-------Вычисление стопа и установка
void SetStop(){
      RefreshRates();
      b0=iLow(NULL,PERIOD_H4,0)-10*Point;
      b1=iLow(NULL,PERIOD_H4,1)-10*Point;
      s0=iHigh(NULL,PERIOD_H4,0)+(Ask-Bid)+10*Point;
      s1=iHigh(NULL,PERIOD_H4,1)+(Ask-Bid)+10*Point;
            
         if( Type==0){
//StopLoss=0;
            if(Bid- StopLoss< StopLevel-0.5*Point) StopLoss=MathMin( b0, b1);
// StopLoss=0;
            if(Bid- StopLoss> StopLevel-0.5*Point) StopLoss=MathMax( b0, b1);
//StopLoss=MathMax( b0, b1);
            OrderModify(OrderTicket(),OrderOpenPrice(), StopLoss,OrderTakeProfit(),0,Red);
         }
         if( Type==1){
//StopLoss=0;
            if( StopLoss-Ask< StopLevel-0.5*Point) StopLoss=MathMax( s0, s1);
//StopLoss=MathMax( s0, s1);
            if( StopLoss-Ask> StopLevel-0.5*Point) StopLoss=MathMin( s0, s1);
//StopLoss=MathMin( s0, s1);
            OrderModify(OrderTicket(),OrderOpenPrice(), StopLoss,OrderTakeProfit(),0,Red);
         }
   }

this is bullshit.

I should check StopLoss, so there is no error 130

and it is necessary to define, what should advisor do, if Stop is too close)

 

Sorry... Bothering the man... Terribly stupid....)

Now I'm confused. where is the + and where is the - 0.5*Point

...
if(Ask<= Enter- StopLevel+0.5*Point){
...
if(Bid>= Enter+ StopLevel-0.5*Point){
...
..and all over the code...
 
Swan >> :

>> three options:

I just got it, man.

 
ALex2008 >> :

Now I'm confused. Where is + and where is - 0.5*Point

I get confused too :)

0.5*Point is subtracted from StopLevel.

if(Ask<= Enter- StopLevel+0.5*Point)
if(Bid>= Enter+ StopLevel-0.5*Point)

= extra.

if( Enter-Ask> StopLevel-0.5*Point)
if(Bid- Enter> StopLevel-0.5*Point)

This makes more sense.

if the distance is more than StopLevel-0.5*Point (more or equal to StopLevel) - pending


stops seem to be ok now)

 

The check seems unnecessary...

if( StopLoss-Ask< StopLevel-0.5*Point) StopLoss=Ask+ StopLevel;

as it is checked before the pending order is set!)

Although on the other hand there could be a spike after opening an order.... ...like the news... and then this option will help to set a stop... Sort of like insurance...

 
Have you tried running it in the tester? What did you get?
 
RomanS >> :
Did you try it in the tester? What happened?

Yes a test is a test) you have to check on a demo...

I attached the test from 01.2008 to yesterday... 300$ depo, 0.1 lot.


Files:
clitesymbol.rar  80 kb
 
ALex2008 >> :

Yes the test is a test) I should at least check it on a demo...

I attached the test from 01.2008 to yesterday ... 300$ depo, 0.1 lot... from 01.2008 to 07.2009


Not bad... congratulations!!!

at first glance a great result, the picture is super.

How many pips does it take/withdraw per trade?

 
ALex2008 писал(а) >>

Yes a test is a test) you have to check on a demo...

I attached the test from 01.2008 to yesterday... 300$ depo, 0.1 lot.

The initial drawdown is a bit high.

 
RomanS >> :

Not bad... congratulations!!!

No need to congratulate.... I'm not so sure about the results of the test, but I'm sure they'll be fine.)

At first glance a great result, the picture is super.

I've been put in my place more than once with these test results, so I'm not really looking at them anymore)

How many pips does it take per trade?

Look at the test... It's always different... In the code, the stop is always different and the profit is removed by 300 pips... or it closes on the opposite signal...