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

 
freesenser:

Good evening guys, advise how can be that on the marketinfo tradeallowed trading and at the same time error 133. i am still in diapers, and here i am stuck. and if the order without a specific financial instrument, it buys, but when i put the symbol of any pair in the buy operator, it gives 133. this is on the demo. advise please what may be the problem. thank you ))


Please give me a code sample
 
IgorM:

is it possible to repaint a bar using an indicator?

i.e. the closed bar that corresponds to the indicator buffer buf[1] was a bearish candle I want to paint this bar with the indicator buffer colour


I want to change the size of arrows icons

how to change the size of the arrows icons, what should be added to the code to make the arrows look bigger, it just draws very small arrows

SetIndexBuffer(0, buf_1);
SetIndexBuffer(1, buf_2);
SetIndexStyle(0, DRAW_ARROW);
SetIndexArrow(0,241);
SetIndexStyle(1, DRAW_ARROW);
SetIndexArrow(1,242);

 
IgorM:


probably not possible, then please tell me

how to change the size of the arrow icons, what should be added to the code to make the arrows larger, but it draws just very small arrows

SetIndexBuffer(0, buf_1);
SetIndexBuffer(1, buf_2);
SetIndexStyle(0, DRAW_ARROW);
SetIndexArrow(0,241);
SetIndexStyle(1, DRAW_ARROW);
SetIndexArrow(1,242);

void SetIndexStyle( int index, int type, int style=EMPTY, int width=EMPTY, color clr=CLR_NONE) 
 

Dear programmers! Unfortunately, I don't have time to learn the MQL4 programming language. I'm asking you to write the following task advisor program (it consists of two parts):

Part one; or 1000 last ticks are written to a txt file and this file is updated with every tick.

Part two; reads a trade condition from another txt file, if the text is 1 then buy, if -1 then sell, if 0 then close order if order is present or do nothing if no order is present.

I want to test my ideas with Mathematica

 
I will share my work in the future.
 
IgorM:

is it possible to repaint a bar using an indicator?

i.e. the closed bar that corresponds to the indicator buffer buf[1] was a bearish candle I want to paint this bar with the indicator buffer colour

Look at the Heiken Ashi indicator, it has a similar effect.

Use the SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, color1) to draw wicks, and use thicker lines SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, color3) to fill the bars.

 
shap:

Dear programmers! Unfortunately, I don't have time to learn the MQL4 programming language. I'm asking you to write the following task advisor program (it consists of two parts):

Part one; or 1000 last ticks are written to a txt file and this file is updated with every tick.

Part two; reads a trade condition from another txt file, if the text is 1 then buy, if -1 then sell, if 0 then close order if order is present or do nothing if no order is present.

I want to test my ideas with Mathematica

extern int    x1 = 100;
extern double lots = 1;
double tick[];
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
ArrayResize(tick,x1);   
//----
   return(0);
  }
int start()
   {
   int handle=FileOpen("tick.txt",FILE_READ);
   if(handle>0)
      {
      for(int i=1;i<x1;i++)
         {
         tick[i]=StrToDouble(FileReadString(handle));
         if(tick[i]==0)break;
         }
      FileClose(handle);
      }   
   tick[0]=Bid;
   string str="";
   for(i=0;i<x1;i++)
      {

      if(tick[i]==0)break;
      str=str+DoubleToStr(tick[i],MarketInfo(Symbol(),MODE_DIGITS))+";";
      }
   handle=FileOpen("tick.txt",FILE_WRITE);
   FileWrite(handle,str);
   FileClose(handle);
   handle=FileOpen("control.txt",FILE_READ);
   if(handle!=-1)
      {
      int control=StrToInteger(FileReadString(handle));
      FileClose(handle);
      FileDelete("control.txt");
      if(control>0)   int ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, 3,0,0); 
      else if(control<0) ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, 3,0,0);
      else
         {
         for (i=OrdersTotal()-1;i>=0;i--)
            {
            OrderSelect(i,SELECT_BY_POS);
            if(OrderSymbol()==Symbol())
            if(OrderType()>1)OrderDelete(OrderTicket());
            else OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3);
            }
         }
      }
   return(0);
 } 
 
Hello. Can you please advise how to implement the following idea: for example, there are several variants of criteria for position opening, say, with Stochastic = 20, 80 and 50 and each variant should correspond to a different variant of closing criteria. Through arrays or something else, I just don't want to resort to them because of a couple of values. I can write the code myself, can you explain the general principles in more details? Thanks in advance.
 
It is possible to have different magiks or comments for orders opened according to different criteria. Then when closing on a paired criterion, the magik or comment is checked.
 
granit77:
It is possible to have different magiks or comments for orders opened according to different criteria. Then when closing on a paired criterion, the magik or comment is checked.
Good idea about the "comments", I will try that, thanks.