[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 966

 
TarasBY:

Can anyone tell me what the problem is?


Until we have the indicator itself, no one will tell us.
 
Vinin:


It is possible. If of course the brokerage company supports it.

Just keep in mind that in the tester you can open positions in the current instrument, and there are some restrictions on other instruments


Does this series of restrictions apply to online trading? If not, it's sad. The code doesn't open anything:

int magic = 428;//магический номер эксперта
extern double volume = 0.1;//объем выставляемого ордера
extern int slippage = 3;//проскальзывание
int OPB;//метка выставляемого ордера на покупку
int OPS;//метка выставляемого ордера на продажу
int Profit=1;//уровень профита открытых ордеров
string comB = "Выставили ордер Buy";//комментарий ордера
string comS = "Выставили ордер Sell";//комментарий ордера
double StochasticCAD;//положение основной линии Стохастики на текущем баре по USDCAD
double StochasticAUD;//положение основной линии Стохастики на текущем баре по AUDUSD

double SARCAD;//текущее положение индикатора по USDCAD
double SARСCAD;//положение индикатора бар назад по USDCAD
double SARAUD;//текущее положение индикатора по AUDUSD
double SARСAUD;//положение индикатора бар назад по AUDUSD


int start()
  {
  
//______________________________определение значений переменных_______________________ 


      StochasticCAD = iStochastic("USDCAD",30,5,3,3,1,1,0,0); 
      StochasticAUD = iStochastic("AUDUSD",30,5,3,3,1,1,1,0);
      
      SARCAD=iSAR("USDCAD",30,0.02,0.2,0);
      SARСCAD=iSAR("USDCAD",30,0.02,0.2,1);
      SARAUD=iSAR("AUDUSD",30,0.02,0.2,0);
      SARСAUD=iSAR("AUDUSD",30,0.02,0.2,1);
      
      double bidCAD=MarketInfo("USDCAD",MODE_BID);
      double askCAD=MarketInfo("USDCAD",MODE_ASK);
      double bidAUD=MarketInfo("AUDUSD",MODE_BID);
      double askAUD=MarketInfo("AUDUSD",MODE_ASK);


........................


//______________выставление ордеров______________________________________________________________________
    
  
    if (SARCAD>askCAD && SARСCAD<bidCAD && SARAUD<bidAUD && SARСAUD>askAUD && OPB<1)//определим условия
     
     {  //_______Buy_______ 

          if(!IsTradeAllowed())
               {
                  Alert("занят торговый поток, повторим попытку бай...");
                  return(-1);
               }
          OPB =OrderSend("GBPUSD",OP_BUY,volume,Ask,slippage,0,0,comB,magic,0,Red); //выставим ордер
            
            if(OPB == -1)
              {
                 Alert("GBPUSD"," ошибка: бай", GetLastError());
                 return(-1);
              }
         
            if(OPB > 1)
            Alert ("GBPUSD","Выставили ордер на покупку!");

     }
      else
     {//_______Sell_______
  
         if (SARСCAD>askCAD && SARCAD<bidCAD && SARСAUD<bidAUD && SARAUD>askAUD && OPS<1)//определим условия
     
         {
          
           if(!IsTradeAllowed())
                {
                   Alert("занят торговый поток, повторим попытку селл...");
                   return(-1);
                }
        
           OPS=OrderSend("GBPUSD",OP_SELL,volume,Bid,slippage,0,0,comS,magic,0,Blue); //выставим ордер


             if(OPS == -1)
               {
                  Alert("GBPUSD"," ошибка: селл", GetLastError());
                  return(-1);
               }
         
             if(OPS > 1)
             Alert ("GBPUSD","Выставили ордер на продажу!");

         }
     }    
   return(0);//выход
  }
 
mInvIn:

Hi all.

Can you tell me please: after testing on the history, is there any way to get the comment or magic number of each trade made, or any other way to identify the trades? Let me try to explain the meaning. Suppose I programmed a few patterns and ran the EA on the history, the result, as it often happens, is loss. It would be interesting to see, which of the patterns and under what market conditions is losing more and more often, and which (if any) shows at least some profit.

Thanks in advance for the answers.

Make it simple. Set the pattern number as an extern parameter. The Expert Advisor should open positions only by this pattern. And if you specify zero, for example, it opens by any pattern. You run optimization by all patterns. You get the summary picture and pattern breakdown.
 
A "New Order" function like "New Bar" is needed. The function should have TRUE value only for one tick after the moment when the order was opened. I.e. at the moment when the number of open orders changes upwards. Please help me
 
Techno:
is there an override of historical orders?
No, only market and pending orders.
 
IgorM:


there is such a problem - i had this problem too, if the Expert Advisor makes many trades per year - perhaps too much data is stored for the output of the final result or maybe the indicator buffers eat the memory

i have seen - i don't know, bear with me - for a general picture, the test is for 10 years, and it's better to optimize for one year and then make a selection of the best parameters

Thank you Igor! Intuitively I am doing so. Thought it might be possible for a longer period not to lose speed as well ?
 

Gurus please advise, I've already racked my brains, I feel it should be easy, I've tried it both ways... I can't...

The essence of the problem:

I am writing an indicator, it catches points in the buffers, in total there should be 4, 2 assembled normally, the values as they should be by bars, either zero or, price, here everything is OK, but we need 2 more buffers in which to put values in this way: if a non-zero value is found for buffer 0, then check whether the previous non-zero value in buffer 0, and if it is less, then the current value is written to buffer 2. I want it to be calculated on the fly, not by searching and looping, it's my first indicator, I've written Expert Advisors and scripts, but I lost my way with indicator and its buffers...

...................

Counted_bars=IndicatorCounted(); // Number of calculated bars

i=Bars-Counted_bars-1; // Index of the first one not counted

while(i>1) // Loop on uncounted bars

{

if (..............) // everything works here

{

Buf_0[i]=High[i];

{ here we want to calculate Buf_2[i] }

}

if (..............) //everything works here too

{

Buf_1[i]=Low[i];

{but here we want to calculate Buf_3[i] }

}

i--;

//calculate index of the next bar

}

//--------------------------------------------------------------------

return; // Exit special function start()

}

//--------------------------------------------------------------------

 
What happens more often - buy or sell? Meaning globally.
 
ChachaGames:

Gurus please advise, I've already racked my brains, I feel it should be easy, I've tried it both ways... I can't...

The essence of the problem:

I am writing an indicator, it catches points in the buffers, in total there should be 4, 2 assembled normally, the values as they should be by bars, either zero or, price, here everything is OK, but we need 2 more buffers in which to put values in this way: if a non-zero value is found for buffer 0, then check whether the previous non-zero value in buffer 0, and if it is less, then the current value is written to buffer 2. I want it to be calculated on the fly, not by searching and looping, it's my first indicator, I've written Expert Advisors and scripts, but I lost my way with indicator and its buffers...

...................

Counted_bars=IndicatorCounted(); // Number of calculated bars

i=Bars-Counted_bars-1; // Index of the first one not counted

while(i>1) // Loop on uncounted bars

{

if (..............) // everything works here

{

Buf_0[i]=High[i];

{ here we want to calculate Buf_2[i] }

}

if (..............) //everything works here too

{

Buf_1[i]=Low[i];

{but here we want to calculate Buf_3[i] }

}

i--;

//calculate index of the next bar

}

//--------------------------------------------------------------------

return; // Exit special function start()

}

//--------------------------------------------------------------------

Roughly speaking, how do I find out the index of the previous non-zero value in the buffer?
 
_SS_:
What happens more often - buy or sell? Meaning globally.
Exactly in half for every sale there is a different buyer :)
Reason: