[UYARI, KONU KAPALI!] Forumu kirletmemek için herhangi bir acemi sorusu. Profesyonel, kaçırmayın. Sensiz hiçbir yerde. - sayfa 113

 
mukata >> :

peki bir soru?

Bir değişkende saklamak, işlevi her seferinde çağırmaktan daha hızlıdır.

Bu arada, bu test cihazında kolayca kontrol edilir.

 
StatBars >> :
Kodunu nereye sakladın? Sadece onu düzeltmek istedim, ama o zaten ...


//+------------------------------------------------------------------+
//| Copyright © 2009, ::: -- SAMER -- ::: |
//| E-MAIL: camep@inbox.ru icq: 422372555 |
//+------------------------------------------------------------------+

extern double TakeProfit = 500;
extern double Lots = 0.1;
extern double Stoploss = 30;
extern double TrailingStop = 30;
extern int iWPRperiod1 = 50;
extern int iWPRperiod2 = 60;
extern int iWPRperiod3 = 60;
extern int iWPRperiod4 = 50;
extern int slowing = 3;
extern int period = 3;
extern int period2 = 5;

int start()
{
double a;
int b;
int total;
int ticket;
int cnt;
int iWPRperiod1;
int iWPRperiod2;
int iWPRperiod3;
int iWPRperiod4;
int slowing;
int period;
int period2;

if(Bars<100)
{
Print("bars less than 100");
return(0);
}

if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return(0);
}

total=OrdersTotal();
if(total<1)
{

if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}

if((iWPR(NULL,0,iWPRperiod1,0)>iWPR(NULL,0, iWPRperiod2,0)) < iStochastic(NULL,0,period2,period,slowing,0,0,0,0) )

{
ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-Stoploss*Point, Ask+TakeProfit*Point,"comment",16384,0,Green);

if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
{
else Print("Error opening BUY order : ",GetLastError());
return(0);
}

if((iWPR(NULL,0,iWPRperiod1,0)>iWPR(NULL,0, iWPRperiod2,0)) > iStochastic(NULL,0,period2,period,slowing,0,0,0,0) )
{
ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+Stoploss*Point,Bid-TakeProfit*Point,"macd sample",16384,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
return(0);
}

for(cnt=0; cnt < total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL &&
OrderSymbol()==Symbol())

{
if(OrderType()==OP_BUY)
{
if(iWPR(NULL,0,iWPRperiod1,0)>iWPR(NULL,0, iWPRperiod2,0))
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet)
return(0);
}

if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}
else
{
if(iWPR(NULL,0,iWPRperiod3,0)<iWPR(NULL,0, iWPRperiod4,0))
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
return(0);
}
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}
return(0);
}

 
TheXpert >> :

Bir değişkende saklamak, işlevi her seferinde çağırmaktan daha hızlıdır.

Bu arada, bu test cihazında kolayca kontrol edilir.

Teşekkürler, ben de öyle düşündüm.

Ama bu forumda ne kadar kod okudum - kimse bunu yapmıyor, herkes her seferinde işlevi çağırıyor. Ve ben de oradayım.

İşlev açık, peki ya dizi?

PS Son zamanlarda burada...

 
//+------------------------------------------------------------------+
//| Copyright © 2009, ::: -- SAMER -- ::: |
//| E-MAIL: camep@inbox.ru icq: 422372555 |
//+------------------------------------------------------------------+

extern double TakeProfit = 500 ;
extern double Lots = 0.1 ;
extern double Stoploss = 30 ;
extern double TrailingStop = 30 ;
extern int iWPRperiod1 = 50 ;
extern int iWPRperiod2 = 60 ;
extern int iWPRperiod3 = 60 ;
extern int iWPRperiod4 = 50 ;
extern int slowing = 3 ;
extern int period = 3 ;
extern int period2 = 5 ;

int start ( )
{
   double a ;
   int b ;
   int total ;
   int ticket ;
   int cnt ;
   int iWPRperiod1 ;
   int iWPRperiod2 ;
   int iWPRperiod3 ;
   int iWPRperiod4 ;
   int slowing ;
   int period ;
   int period2 ;

   if ( Bars < 100 )
   {
       Print ( "bars less than 100" ) ;
       return ( 0 ) ;
   }

   if ( TakeProfit < 10 )
   {
       Print ( "TakeProfit less than 10" ) ;
       return ( 0 ) ;
   }

   total = OrdersTotal ( ) ;
   if ( total < 1 )
   {

       if ( AccountFreeMargin ( ) < ( 1000 * Lots ) )
       {
         Print ( "We have no money. Free Margin = " , AccountFreeMargin ( ) ) ;
         return ( 0 ) ;
       }

       if ( ( iWPR ( NULL , 0 , iWPRperiod1 , 0 ) > iWPR ( NULL , 0 , iWPRperiod2 , 0 ) ) < iStochastic ( NULL , 0 , period2 , period , slowing , 0 , 0 , 0 , 0 ) )
       {
         ticket = OrderSend ( Symbol ( ) , OP_BUY , Lots , Ask , 3 , Ask - Stoploss * Point , Ask + TakeProfit * Point , "comment" , 16384 , 0 , Green ) ;

         if ( ticket > 0 )
         {
             if ( OrderSelect ( ticket , SELECT_BY_TICKET , MODE_TRADES ) ) Print ( "BUY order opened : " , OrderOpenPrice ( ) ) ;
             else Print ( "Error opening BUY order : " , GetLastError ( ) ) ;
             return ( 0 ) ;
         }
       }
       if ( ( iWPR ( NULL , 0 , iWPRperiod1 , 0 ) > iWPR ( NULL , 0 , iWPRperiod2 , 0 ) ) > iStochastic ( NULL , 0 , period2 , period , slowing , 0 , 0 , 0 , 0 ) )
       {
         ticket = OrderSend ( Symbol ( ) , OP_SELL , Lots , Bid , 3 , Bid + Stoploss * Point , Bid - TakeProfit * Point , "macd sample" , 16384 , 0 , Red ) ;
         if ( ticket > 0 & & OrderSelect ( ticket , SELECT_BY_TICKET , MODE_TRADES ) ) Print ( "SELL order opened : " , OrderOpenPrice ( ) ) ;
         else 
         {
             Print ( "Error opening SELL order : " , GetLastError ( ) ) ;
             return ( 0 ) ;
         }
       }
       return ( 0 ) ;
   }   

   for ( cnt = 0 ; cnt < total ; cnt + + )
   {
       OrderSelect ( cnt , SELECT_BY_POS , MODE_TRADES ) ;
       if ( OrderType ( ) < = OP_SELL & & OrderSymbol ( ) = = Symbol ( ) ) 
       {
         if ( OrderType ( ) = = OP_BUY )
         {
             if ( iWPR ( NULL , 0 , iWPRperiod1 , 0 ) > iWPR ( NULL , 0 , iWPRperiod2 , 0 ) )
             {
               OrderClose ( OrderTicket ( ) , OrderLots ( ) , Bid , 3 , Violet ) ;
               return ( 0 ) ; 
             }
             if ( TrailingStop > 0 )
             {
               if ( Bid - OrderOpenPrice ( ) > Point * TrailingStop )
               {
                   if ( OrderStopLoss ( ) < Bid - Point * TrailingStop )
                   {
                     OrderModify ( OrderTicket ( ) , OrderOpenPrice ( ) , Bid - Point * TrailingStop , OrderTakeProfit ( ) , 0 , Green ) ;
                     return ( 0 ) ;
                   }
               }
             }
         }
         else
         {
             if ( iWPR ( NULL , 0 , iWPRperiod3 , 0 ) < iWPR ( NULL , 0 , iWPRperiod4 , 0 ) )
             {
               OrderClose ( OrderTicket ( ) , OrderLots ( ) , Ask , 3 , Violet ) ;
               return ( 0 ) ;
             }
             if ( TrailingStop > 0 )
             {
               if ( ( OrderOpenPrice ( ) - Ask ) > ( Point * TrailingStop ) )
               {
                   if ( ( OrderStopLoss ( ) > ( Ask + Point * TrailingStop ) ) | | ( OrderStopLoss ( ) = = 0 ) )
                   {
                     OrderModify ( OrderTicket ( ) , OrderOpenPrice ( ) , Ask + Point * TrailingStop , OrderTakeProfit ( ) , 0 , Red ) ;
                     return ( 0 ) ;
                   }
               }
             }
         }
       }
   }
return ( 0 ) ;
}

En basit sözdizimi hatalarını düzelttim, en "kolay" olanı - mantıklı olanları düzeltmeniz gerekiyor. :)

 
if ( ( iWPR ( NULL , 0 , iWPRperiod1 , 0 ) > iWPR ( NULL , 0 , iWPRperiod2 , 0 ) ) < iStochastic ( NULL , 0 , period2 , period , slowing , 0 , 0 , 0 , 0 ) )
if ( ( iWPR ( NULL , 0 , iWPRperiod1 , 0 ) > iWPR ( NULL , 0 , iWPRperiod2 , 0 ) ) > iStochastic ( NULL , 0 , period2 , period , slowing , 0 , 0 , 0 , 0 ) )
Garip inşaat.
 
StatBars >> :

Bunu bana nasıl kopyalayabilirim ^^

programa kopyalandığında her şey tek satır olur (

 
FOREXMASTER писал(а) >>

Bunu bana nasıl kopyalayabilirim ^^

programa kopyalandığında her şey tek satır olur (

Dosyalar:
 
StatBars >> :

Teşekkür ederim!)

 
TheXpert >> :

Bir değişkende saklamak, işlevi her seferinde çağırmaktan daha hızlıdır.

Bu arada, bu test cihazında kolayca kontrol edilir.

İşlev açık, peki ya dizi?

ayrıca test cihazında sürmek için çok şey yeniden yazın.

değişkenle, her seferinde bir işlevi çağırmaktan daha hızlıdır ve bir dizi öğesi, basit bir değişkenin okunduğu kadar hızlı mıdır?

veya daha uzun, bir dizi mi, dizine göre mi aramanız gerekiyor, yoksa bir değişkenle aynı mı?

Bu incelikleri anlamıyorum.

 
mukata >> :

İşlev açık, peki ya dizi?

Bu incelikleri anlamıyorum.

Bir kod örneği ile göstermek daha iyidir.


Bir dizi ile belirsizlikler vardır.


Bir EA'nın veri yorumlamayla ilgili diziler içermemesi gerektiğine inanıyorum. Göstergelerde yeri var.

Buradaki çoğu kişi aksini düşünüyor. Ve her şeyi bir danışmana sıkıştırmaya çalışıyorlar.

Neden: