[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 804

 
Maniac:


Here is the code of the Expert Advisor. It needs:

1) he opened not one, but three deals at once with stops of 25 and takeovers of 15, 35, 50

2) after the second order is closed at take (35), the last position (with take 50) is brought to the breakeven point

You use Igor Kim's functions... Among all the variety of ready-made functions
that he has made available to all, have you not found ways to solve your "problem"?
Believe me they are there and even enough of them...
It's a good place to start learning...
Also - read this section of IC's tutorial - it well describes how to structure your code and break it into logically structured code blocks,
Each block has its own function within the Expert Advisor...
You've got it all in one pile... :)
IMHO of course... :)
 
That's a hell of a way to make a girl dance... <:-О ...
There is a Buy position with ticket 88. There is a SellStop pending order with ticket 89
When SellStop pending order is converted to market order, ticket of market Sell becomes 89 too,
but BUY POSITION TICKET (88) WILL BE IN THE HISTORY!!! How can this be - it's not closed and is on the market !!!??????????????
I.e. when checking:
if (OrderSelect(CurTicB,SELECT_BY_TICKET,MODE_HISTORY)) // CurTicB равен тикету позы, т.е. 88
   {
      if (OrderType()==OP_BUY)
          {
              Print("Поза Buy с тикетом ",CurTicB," отошла, блин в мир иной, сволочь!!!",", и типчик у неё = ",OrderType());
              SaveCurB = false;   
          }
      else if (OrderType()==OP_BUYSTOP) Print("Поза Buy с тикетом ",CurTicB," отошла, блин в мир иной, сволочь!!!",", а типчик у неё = ",OrderType());
   }

... it says in my journal:

2010.08.15 09:38:52 2009.01.09 19:36 Sergitas_v1.02 EURUSD,M5: The Buy position with ticket 88 has gone bloody well into the next world, the bastard!!!, and her type = 0

And she's feeling great in the market at the same time... !!!!!!!!!!! ?????????
Can someone point me in the direction of something so I can see where it's going... ...and how to deal with it... This is the third day she's pissed me off...

( That's why my expressions in the tester's journal are stronger than the ones I've corrected here... :)) )

Thanks...

 
artmedia70:
That's a hell of a way to make a girl dance... <:-О ...
There is a Buy position with ticket 88. There is a SellStop pending order with ticket 89
When transforming a pending SellStop to a market one, the ticket of the market Sell becomes 89 as well,
BUT THE BUY POSITION TICKET (88) GETS INTO THE HISTORY! How can this be - because it is not closed and is in the market !!!??????????????
I.e. when checking:

... it says in my journal:

2010.08.15 09:38:52 2009.01.09 19:36 Sergitas_v1.02 EURUSD,M5: Buy pose with ticket 88 has gone to the other world, bastard!!!, and its type = 0

And she's feeling great in the market in the meantime... !!!!!!!!!!! ?????????
Can someone point me in the direction of something so I can see where it's going... ...and how to deal with it... This is the third day she's pissed me off...

( That's why my expressions in the tester's journal will be stronger than those I corrected here... :)) )

Thank you...


The tester is flawless!

Like all code and usability MetaQuotes Software Corp ...

Otherwise it's a ban.

Look for crookedness in MicroPrograms and yourself!

;)

 

I'm starting to believe in the bugs...

The Buy position closed out of the blue on the Take Profit level of an already closed Sell position:


There is no stop on Buy position and it just... and closed and so
interesting - right at the level of the take profit of a closed Sell position ...

Looks like... there's an undead in my flat... or I need more sleep... :)

Has anyone had such a mess?

I don't know...

 
FreeLance:

The tester is flawless!

So is all the code and usability of MetaQuotes Software Corp ...

Otherwise, you're banned.

Look for crookedness in MicroPrograms and yourself!

;)

A most informative answer... bow low... I bow and with crooked hands drop the pots from the shelves... No splinters? ;)
 
artmedia70:
A most informative answer... bow down... I bow, and with my crooked hands I drop the pots from the shelves. Did you get any splinters? ;)

no of course - God's dew! $)

and you're just getting started...

;)

 
artmedia70:
That's a hell of a way to make a girl dance... <:-О ...
There is a Buy position with ticket 88. There is a SellStop pending order with ticket 89
When transforming a pending SellStop to a market one, the ticket of the market Sell becomes 89 as well,
BUT THE BUY POSITION TICKET (88) GETS INTO THE HISTORY! How can this be - because it is not closed and is in the market !!!??????????????
I.e. when checking:

... it says in my journal:

2010.08.15 09:38:52 2009.01.09 19:36 Sergitas_v1.02 EURUSD,M5: Buy pose with ticket 88 has gone to the other world, bastard!!!, and its type = 0

And it is doing a very good job in the market at that time... !!!!!!!!!!! ?????????
Can someone poke me in something so I can see where the problem lies... ...and how to deal with it... This is the third day she's pissed me off...

( That's why my expressions in the tester's journal will be stronger than those I corrected here... :)) )

Thank you...

I suggest that you carefully read the description of the OrderSelect() function.

The parameter pool is ignored if the order is selected using the ticket number

 
artmedia70:

I'm starting to believe in the bugs...

The Buy position closed out of the blue on the Take Profit level of an already closed Sell position:


There is NO stop in the Buy position but it has closed...! and closed and so
interesting - right at the level of take the already closed Sell position ...

Looks like... there's an undead in my flat... or I need more sleep... :)

Who has had such a mess?

I don't know...

It's hard to tell what you have there. I do not see that "The Buy position suddenly closed at TakeProfit level of an already closed Sell position". That Sell, under which the arrow is drawn, does not seem to contain any dashes.

Do you not use OrderCloseBy() in your code?

 
double verhB=iBands(NULL,0,BandsPeriod,Bands_shift,Deviations,PRICE_CLOSE,1,0);//calculate top line indicator
double seredina=iBands(NULL,0,BandsPeriod,Bands_shift,Deviations,PRICE_CLOSE,0,0);//calculate top line indicator//
double nizB=iBands(NULL,0,BandsPeriod,Bands_shift,Deviations,PRICE_CLOSE,2,0);//calculate bottom line indicator//
//---------------------------------------------------------------------------------------------------------------//
double slb,tpb,sls,tps; //Input variables for Stop Loss and Take Profit////
//Function checks for the presence of orders // // //
// //
slb=NormalizeDouble(Ask - (Loss*Point),Digits) ; //calculate stop for buy positions//
tpb=NormalizeDouble(Ask + (Profit*Point),Digits); //calculate profit for buy positions////////////
sls=NormalizeDouble(Bid + (Loss*Point),Digits) ; //calculate stop for sell positions//
tps=NormalizeDouble(Bid - (Profit*Point),Digits);
if(OrdersTotal()==0)
{
if(((verhB-nizB)<=Delta)&&(Ask==seredina))

tick =OrderSend(Symbol(),4,Lots,NormalizeDouble(Ask+Raznica*Point,Digits),Slip,slb,tpb,NULL,MagicNumber,0,CLR_NONE); //Buy entry//
if(tick<0) Print("Error # - ",GetLastError());

tick2=OrderSend(Symbol(),5,Lots,NormalizeDouble(Bid-Raznica*Point,Digits),Slip,sls,tps,NULL,MagicNumber,0,CLR_NONE); //Input sat //
if(tick2<0) Print("Error # - ",GetLastError()); //write error//
} // // // //
return(0);}



Tell me what the error is, it only opens.

The meaning of the Expert Advisor is that would put two pendants at a certain distance of upper and lower limit of Bollinger

 

and what is the error ?

it could be because the value of Raznica is close to the value of stoplevel

and/or the difference Raznica - Profit (Raznica - Loss) is also close to the value of stoplevel...

in addition, if normalize, normalize everything... and correctly calculate stop levels

slb=NormalizeDouble(Bid - (Loss*Point),Digits) ; //calculate stop for buy positions//
sls=NormalizeDouble(Ask + (Loss*Point),Digits) ; //calculate stop for sell positions//

besides obtained stop values should be checked for being out of the stoplevale/freezelevale zone

Reason: