[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 444

 
kostikk:


Thank you!!!

Do you know the function where you can set the trading time, i.e. EA trades only from 11:00 till 19:00 after 19:00 it closes position or places a stop and does not open a position till next morning 09:00

Thank you


You are welcome! I do not use the open time function. It's a better option for optimisation:

extern int    stArt  = 11;
extern int    stOpen = 19;

------------------------------
int start()
{
  int h = TimeHour(TimeCurrent());

------------------------------

    if((stArt < stOpen && h >= stArt && h < stOpen) || (stArt >= stOpen && (h >= stArt || h < stOpen)))//условие входа

//для выключения действия условия поставь любое значение, одинаковое для переменных. 
//Экономит число перестановок,значит и время при оптимизации! 
Good luck!
 

Please tell me what I missed when I redid the code for horizontal lines

int start()
  {
  bool fm=false;
  int GLE=0;
  double SvojstvoUP=111,SvojstvoDOWN=111,SvojstvoAM=TimeLocal()-4*60*60,SvojstvoPM=0;
  
  fm=ObjectCreate("UP_LEVEL",OBJ_HLINE,0,Time[0],Bid+111*Point);
  if(fm==0 || fm==-1)
  fm=ObjectSet("UP_LEVEL",OBJPROP_COLOR,Green);
  if(fm==0 || fm==-1)
  fm=ObjectSet("UP_LEVEL",OBJPROP_WIDTH,5);
  if(fm==0 || fm==-1)
   
 
  SvojstvoUP=ObjectGet("UP_LEVEL",OBJPROP_PRICE1);
            if(SvojstvoUP==111)
  if(SvojstvoUP!=Bid+111*Point){
   fm=ObjectSet("UP_LEVEL",OBJPROP_PRICE1,Bid+111*Point);
  if(fm==0 || fm==-1)
  return(0);}
 
 
  fm=ObjectCreate("DOWN_LEVEL",OBJ_HLINE,0,0,Bid-111*Point);
  if(fm==0 || fm==-1)
  fm=ObjectSet("DOWN_LEVEL",OBJPROP_COLOR,Red);
  if(fm==0 || fm==-1)
  fm=ObjectSet("DOWN_LEVEL",OBJPROP_WIDTH,1);
  if(fm==0 || fm==-1)
 
  SvojstvoDOWN=ObjectGet("DOWN_LEVEL",OBJPROP_PRICE1);
            if(SvojstvoDOWN==111)
  if(SvojstvoDOWN!=Bid-111*Point){
   fm=ObjectSet("DOWN_LEVEL",OBJPROP_PRICE1,Bid-111*Point);
  if(fm==0 || fm==-1)
  return(0);}         

into the code for vertical lines.

  fm=ObjectCreate("AM_LEVEL",OBJ_VLINE,0,TimeLocal()-4*60*60,0);
  if(fm==0 || fm==-1)
  fm=ObjectSet("AM_LEVEL",OBJPROP_COLOR,Yellow);
  if(fm==0 || fm==-1)
  fm=ObjectSet("AM_LEVEL",OBJPROP_WIDTH,1);
  if(fm==0 || fm==-1)
  
 
  SvojstvoAM=ObjectGet("AM_LEVEL",OBJPROP_PRICE1);
            if(SvojstvoAM==TimeLocal()-4*60*60)
  if(SvojstvoAM!=TimeLocal()-4*60*60){
   fm=ObjectSet("AM_LEVEL",OBJPROP_PRICE1,TimeLocal()-4*60*60);
  if(fm==0 || fm==-1)
  return(0);}
 
 
  fm=ObjectCreate("PM_LEVEL",OBJ_VLINE,0,Time[0],0);
  if(fm==0 || fm==-1)
  fm=ObjectSet("PM_LEVEL",OBJPROP_COLOR,Black);
  if(fm==0 || fm==-1)
  fm=ObjectSet("PM_LEVEL",OBJPROP_WIDTH,1);
  if(fm==0 || fm==-1)
 
  SvojstvoPM=ObjectGet("PM_LEVEL",OBJPROP_PRICE1);
            if(SvojstvoPM==0)
  if(SvojstvoPM!=Time[0]){
   fm=ObjectSet("PM_LEVEL",OBJPROP_PRICE1,Time[0]);
  if(fm==0 || fm==-1)
  return(0);}         
   
  return(0);
  }

If there are no lines, they are drawn normally, the error in the second part when. When they start to check for their presence and rearrange if they are not in place.

 
7777877:
I cannot believe that this is such a difficult question that no one can answer!!!!! ... many times I post because the question often 'slips through' because of other questions and answers to those other questions

No one is willing to deal with your question. Although you could have answered your question a long time ago, if you wanted to of course.
 

What is this message?

2012.10.18 22:07:26 '64580': order buy 0.10 GOLD opening at 1743.24 sl: 0.00 tp: 0.00 failed[Trade is disabled] Why is trading disabled?

 
Elektronik:

Please tell me what I missed when I redid the code for horizontal lines


If there are no lines, they are drawn normally, the error is in the second part when. When check for their presence and rearrange them if they are not in place.

I personally don't check for objects that need to be rearranged. Label is one. I simply delete the object(s) with the mark(s) and draw in a new location. If there was no object before deletion = no big deal.
 
yosuf:

What is this message?

2012.10.18 22:07:26 '64580': order buy 0.10 GOLD opening at 1743.24 sl: 0.00 tp: 0.00 failed [Trade is disabled] Why is trading disabled?

Maybe gold is not traded in this brokerage company at this time? And the terminal was updated, by the way, remember it did not work? This is off-topic, just curious.
 
Sepulca:

Yeah, if Uncle Kolya's here....

what do you mean?
 

good day to all..... guys again need your help. here's the question: let's say I have a pattern of 5 candles, I want to use it in a test on several timeframes (sorry for the rub.:)) in the test open chart for 5 min.how do I link the candles to a timeframe (again sorry for the rub.:)) and already for one to another currency SPASIBLE!

 
snail09_1:
Maybe gold is no longer traded at this time in this DC? Did they update the terminal, by the way, remember, it didn't work? This is off-topic, just wondering.
Passed that ill-fated section of the code, but stumbled on the other, concluding section. Looking for the reason, thanks for the tip.
 
snail09_1:
Personally, I don't check for objects that need to be rearranged. The label is the same. I just delete the object(s) with the label(s) and draw in a new location. If there was no object before deletion = no big deal.


Option, but object properties are not saved when deleting.

figured it out, missed OBJPROP_PRICE1

Reason: