[Arşivle!] Forumu kirletmemek için herhangi bir acemi sorusu. Profesyonel, kaçırmayın. Sensiz hiçbir yerde - 2. - sayfa 393

 
 
 
//+------------------------------------------------------------------+
//|                                                    для лавин.mq4 |
//|                      Copyright © 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
extern double stoploss=0; extern double takeprofit=20;extern int otstup=20; extern datetime expiration=0;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
 int tiket,tikett;double volume=0.1;int i=0,R1=0,R2=0,A=1 ;double price=PRICE_OPEN;
   //  R1=((PRICE_OPEN- stoploss*Point)*stoploss)/stoploss;R2=((PRICE_OPEN+ stoploss*Point)*stoploss)/stoploss;
     
     
int start()
  {       int X;       
//----
       for(int Uy=OrdersTotal();Uy<=-1;Uy--){
OrderSelect( Uy,SELECT_BY_POS );
if(OrderSymbol()==Symbol()&&OrderMagicNumber( )==1000||OrderMagicNumber( )==2000 &&OrderSymbol()==Symbol())
{X=X++;}}  
if (X>=2){
   tiket= OrderSend( Symbol(), OP_BUYSTOP,  volume*A, price +otstup*Point, Point* 3, R1, PRICE_OPEN+takeprofit*Point+otstup, "OP_BUYSTOP", 1000,  expiration, Red); 
   Alert ("OP_BUYSTOP", GetLastError( )); 
   tikett= OrderSend( Symbol(), OP_SELLSTOP,  volume*A, price -otstup*Point, Point* 3,R2, PRICE_OPEN-takeprofit*Point-otstup, "OP_SELLSTOP" , 2000,  expiration,C'0,128,255' );
    Alert ("OP_SELLSTOP", GetLastError( )); 
    }       
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
Dimka-novitsek :

{X=X++;}}  

veya X=X+1; veya X++; ))

ve yine ilkinin döngü durumuna tekrar bakın

 
Teşekkürler!!!!!!!!
 

Sevgili uzmanlar! Her zamanki SMA grafikte yatay bir çizginin seviyesini geçtiğinde siparişleri açan bir komut dosyası arıyorum. SMA çizgiyi aşağıdan aşarsa - al, tersi - sat. Mum kapanışında işlem görür. Yayınlandıysa, nerede bulacağımı bana bildirin.

Saygılar vb.

 

Hiçbir şey anlamıyorum.Birincisi benim döngüm çalışmıyor. İkincisi, yanlış duraklar da dahil olmak üzere bir sürü hata yazıyor, (!!Sadece yoklar, sıfırlar!!!!) Ve yine de 5-1o sipariş açıyor!!

Fiyatlandırma neden doğru değil?

İlk fikir, fiyattan yaklaşık 20 pp uzaklıkta iki emir açmak, biri daha yüksek bir daha düşük (otstup = 20), kar al 20 daha fazla (örneğin) daha yüksek veya daha düşük.

 //+------------------------------------------------------------------+
//|                                                    для лавин.mq4 |
//|                      Copyright © 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link       "http://www.metaquotes.net"
extern double stoploss= 0 ; extern double takeprofit= 20 ; extern int otstup= 20 ; extern datetime expiration= 0 ;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
 int tiket,tikett; double volume= 0.1 ; int i= 0 ,R1= 0 ,R2= 0 ,A= 1 ; double price= PRICE_OPEN ;
   //  R1=((PRICE_OPEN- stoploss*Point)*stoploss)/stoploss;R2=((PRICE_OPEN+ stoploss*Point)*stoploss)/stoploss;
     
     
int start()
  {       int X;       
//----
       for ( int Uy= OrdersTotal ();Uy<=- 1 ;Uy--){
OrderSelect ( Uy,SELECT_BY_POS );
if (OrderSymbol()== Symbol ()&&OrderMagicNumber( )== 1000 ||OrderMagicNumber( )== 2000 &&OrderSymbol()== Symbol ())
{X++;}}  
if (X<= 2 ){
   tiket= OrderSend ( Symbol (), OP_BUYSTOP,  volume*A, price +otstup* Point , Point * 3 , R1, PRICE_OPEN +takeprofit* Point +otstup* Point , "OP_BUYSTOP" , 1000 ,  expiration, Red ); 
   Alert ( "OP_BUYSTOP" , GetLastError ( )); 
   tikett= OrderSend ( Symbol (), OP_SELLSTOP,  volume*A, price -otstup* Point , Point * 3 ,R2, PRICE_OPEN -takeprofit* Point -otstup* Point , "OP_SELLSTOP" , 2000 ,  expiration, C'0,128,255' );
     Alert ( "OP_SELLSTOP" , GetLastError ( )); 
    }       
   
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+

Evet, X, bu döviz çiftindeki ve bu belirli EA tarafından açılan siparişlerin sayısıdır.

 
Dimka-novitsek :
Evet, X, bu döviz çiftindeki ve bu belirli EA tarafından açılan siparişlerin sayısıdır.

istediğin bu aslında en az 2 hatadan dolayı orda ne olacağını kimse bilemez

- ilk döngüde, bunun hakkında zaten konuştum

- ilk anda OrderSelect işlevinde olmayan bir sipariş seçersiniz


2) OrderSend'deki fiyatları normalleştirin

 
Anladım teşekkürler. Ve bu arada, fiyatlar orada tamsayı gibi görünüyor, onları bölmedim.
 

- ilk anda OrderSelect işlevinde olmayan bir sipariş seçersiniz

Ve o zaman genel olarak bu mantıksal zavarot'u kaydetmek nasıl doğru olur???