Coup! - page 8

 

Since I started here, I'll continue here.... I'm having a hard time with this. I wrote an EA, but I can not understand why it does not put everything completely. The strategy is certainly unprofitable, but I wonder why the shifter does not work to the end I would say....

It opens positions but not always lucky, I would say. Anybody can help????

int start()
  {
int TotalOrders, TotalOrders1;
int i,ticket,ticket1;
//if (b!=Bars){
b=Bars;
support=NormalizeDouble(iCustom(NULL, 0, "TDSEQUENTA v0000",set,up,zukko1,TT,0,0),5);
resist=NormalizeDouble(iCustom(NULL, 0, "TDSEQUENTA v0000",set,up,zukko1,TT,1,0),5);


if ((Last_Close_Loss()>0)&&(Prezent_Order()==false)){
               if (MathAbs(Last_Close_Loss())==resist+step*Point)OrderSend(Symbol(),OP_BUYSTOP,Lot,resist+step*Point,3,resist-step*Point,Ask+TakeProfit*Point);  
               if (MathAbs(Last_Close_Loss())==support+step*Point)OrderSend(Symbol(),OP_BUYSTOP,Lot,support+step*Point,3,support-step*Point,resist-step*Point); 

}
if ((Last_Close_Loss()<0)&&(Prezent_Order()==false)){
               if (MathAbs(Last_Close_Loss())==resist-step*Point)OrderSend(Symbol(),OP_SELLSTOP,Lot,resist-step*Point,3,resist+step*Point,support-step*Point);  
               if (MathAbs(Last_Close_Loss())==support-step*Point)OrderSend(Symbol(),OP_SELLSTOP,Lot,support-step*Point,3,support+step*Point,Ask-TakeProfit*Point); 
}



 if ((support!=support1)||(resist!=resist1)){
            seljak=true;
            bajak=true;
        TotalOrders=OrdersTotal();
        for (i=0; i<=TotalOrders; i++){
                 if (OrderSelect(0,SELECT_BY_POS)==true){
                    if (OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,5,Red);
                    if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,5,Red);
                    if (OrderType()==OP_SELLSTOP) OrderDelete(OrderTicket(),Green);
                    if (OrderType()==OP_BUYSTOP) OrderDelete(OrderTicket(),Green);
                    if (OrderType()==OP_SELLLIMIT) OrderDelete(OrderTicket(),Green);
                    if (OrderType()==OP_BUYLIMIT) OrderDelete(OrderTicket(),Green);
                 
                 }
        }
                      
}  
if (support!=support1){
         if (support<resist){
 
            ticket=OrderSend(Symbol(),OP_SELLSTOP,Lot,support-step*Point,3,support+step*Point,Ask-TakeProfit*Point);
            ticket1=OrderSend(Symbol(),OP_BUYLIMIT,Lot,support+step*Point,3,support-step*Point,resist-step*Point); 

            ticket=OrderSend(Symbol(),OP_SELLLIMIT,Lot,resist-step*Point,3,resist+step*Point,support+step*Point);
            ticket1=OrderSend(Symbol(),OP_BUYSTOP,Lot,resist+step*Point,3,resist-step*Point,Ask+TakeProfit*Point); 
            if (ticket<0) return(0); 
            if (ticket1<0) return(0);          
         

}
}
if (resist!=resist1){
         if (support<resist){
       
            ticket=OrderSend(Symbol(),OP_SELLSTOP,Lot,support-step*Point,3,support+step*Point,Ask-TakeProfit*Point);
            ticket1=OrderSend(Symbol(),OP_BUYLIMIT,Lot,support+step*Point,3,support-step*Point,resist-step*Point); 

            ticket=OrderSend(Symbol(),OP_SELLLIMIT,Lot,resist-step*Point,3,resist+step*Point,support+step*Point);
            ticket1=OrderSend(Symbol(),OP_BUYSTOP,Lot,resist+step*Point,3,resist-step*Point,Ask+TakeProfit*Point); 
            if (ticket<0) return(0); 
            if (ticket1<0) return(0);          
         
}
}




resist1=resist;
support1=support;


//}
   
  return(0);
  }
 //Проверка лосей 
double Last_Close_Loss(){
double Last_profit=0, Last_close_lots=0,Last_Type=0,Last_Open_Price=0 ; int time=0; 
//---------
   for (int i=OrdersHistoryTotal();i>=1;i--){
         if(OrderSelect(i-1, SELECT_BY_POS, MODE_HISTORY))
         if(OrderSymbol ()!= Symbol())continue;
         if(OrderType() <=1 )
           {if(OrderCloseTime()>time){time=OrderCloseTime();
                                      Last_profit=OrderProfit()+OrderSwap();
                                      Last_Type=OrderType();
                                      Last_Open_Price=OrderOpenPrice();
                                      }
           }
        }    
if(Last_profit<0){
   if (Last_Type==OP_SELL) Last_Open_Price=Last_Open_Price*(-1);
}
     return(Last_Open_Price);
   
} 
//Проверка наличия отложенника по цене.   
bool Prezent_Order(){
bool Chek=false; 
int TotalOrders,i;
        TotalOrders=OrdersTotal();
        for (i=0; i<=TotalOrders; i++){
                 if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true){
                  if (OrderOpenPrice()==MathAbs(Last_Close_Loss())) Chek=true;   
                 }
        }

 return(Chek);  
} 

Ie it somehow does not work up to the end and in some cases gives out an error 130..... Like wrong stops, although I checked everything... Looks like it's even....

PLEASE!!!!! Help or clue me in to where the error is????

trade result actually

Sweep puts orders in one direction only, but I want it to beat them in one direction. I can't decide what to do with it :(((((

 
nikelodeon:

Since I started here, I'll continue here.... I'm having a hard time with this. I wrote an EA, but I can not understand why it does not put everything completely. The strategy is certainly unprofitable, but I wonder why the shifter does not work to the end I would say....

It opens positions but not always lucky, I would say. Anybody can help????

Ie it somehow does not work up to the end and in some cases gives out an error 130..... Like wrong stops, although I checked everything... Looks like it's even....

PLEASE!!!!! Help or clue me in to where the error is????

trade result actually

Sweep puts orders in one direction only, but I want it to beat them in one direction. I can't decide what to do with it :(((((

Hi. I advise you to keep an end-to-end control of orders, each level has its own order comment, and be sure to check the price indent on the stop loss before placing orders. The algorithm can be simplified - only 4 orders, one can be in the market. Put a stop on levels - we open automatically on the stop. We look at all orders - if a market take has triggered outside the channel, we remove the pending orders. I understand we are working from inside the channel.
 
FION:
Hi. I advise you to keep an end-to-end control of orders, each level has its own order comment, and be sure to check the price indent on the stop loss before placing orders. The algorithm can be simplified - only 4 orders, one can be in the market. Put a stop on levels - we open automatically on the stop. We look at all orders - if a market take has triggered outside the channel, we remove the pending orders. I understand we are working from inside the channel.

No, we are working from the line.....
 
It's just not quite clear where the error lies. It seems to be all right....
 
nikelodeon:
It's just not quite clear where the error lies. This seems to be correct....
You have to keep in mind that when you set a buy limit, the condition should always be met: its opening price should always be lower than the current market price and vice versa for sell limit. Your price is linked to the indicator and not to the current market price, so the above condition may not always be met.
 


I've got it set up after all! :)

Guys, can you help me

to the owl with the multiplication parameters that can be set up?!

please!

Files:
vlad_2.mq4  12 kb
 
vladds, will you also charge $10,000 on a real account for this EA?
 
Bicus:
vladds, you also need $10 000 for this EA on a real account?

it's still raw.

the test itself ran at night at 3 o'clock, the test ended at 10:30 :)

as for the EA, it needs to be fine-tuned and connected in general, I have just written it as a golden corridor

 
vladds:


I've got it set up after all! :)


It's pretty good. Don't forget to share the settings with other villagers.

 
4x-online:

You set it up nicely. Don't forget to share the settings with other villagers.


the last owl posted is set up!