buy and sell every 10 points

 

hello every body, i need a help if possible, i trying to create EA Can work in the following form: sell and buy every 10 points move and don't repeat the same order on the same price if the previous not closed.
thank you for your help :)

 
georgioooo:

hello every body, i need a help if possible, i trying to create EA Can work in the following form: sell and buy every 10 points move and don't repeat the same order on the same price if the previous not closed.
thank you for your help :)


no one is possible to help you... if we can't see how you trie to make this program and you don't tell where you struggle
 

maybe if you help me in this:

i want to do one order buystop at price 1.2250 but and when the order taken by the server and close the order at 1.2255 "after 5 points" he do the same order when the price is lower then 1.2250

this what i'm trying to do:

double y=1.2250;

OrderSend("EURUSD",OP_BUYSTOP,0.1,y,0,0,y+5*Point,0,0);

if(ticket>1)

OrderDelete(ticket1);

thank you for your help

 
deVries:

no one is possible to help you... if we can't see how you trie to make this program and you don't tell where you struggle

maybe if you help me in this:

i want to do one order buystop at price 1.2250 but and when the order taken by the server and close the order at 1.2255 "after 5 points" he do the same order when the price is lower then 1.2250

this what i'm trying to do:

double y=1.2250;

OrderSend("EURUSD",OP_BUYSTOP,0.1,y,0,0,y+5*Point,0,0);

if(ticket>1)

OrderDelete(ticket1);

thank you for your help

 
georgioooo:

maybe if you help me in this:

i want to do one order buystop at price 1.2250 but and when the order taken by the server and close the order at 1.2255 "after 5 points" he do the same order when the price is lower then 1.2250

this what i'm trying to do:

double y=1.2250;

OrderSend("EURUSD",OP_BUYSTOP,0.1,y,0,0,y+5*Point,0,0);

if(ticket>1)

OrderDelete(ticket1);

thank you for your help


Do you have more lines ???

What is ticket ??? What is ticket1 ???

Is your broker using 4 digits for displaying price EURUSD ?? Is your openingprice> Bid? Is it allowed to place your buystop at that price ??

What errors do you see compiling your program in the MetaEditor....?

Use SRC Button to post your code....

 
georgioooo:
this what i'm trying to do:
double y=1.2250;

OrderSend("EURUSD",OP_BUYSTOP,0.1,y,0,0,y+5*Point,0,0);

if(ticket>1)

OrderDelete(ticket1);

  1. You're trying to open a buy stop and immediately delete it?
  2. What is ticket? (It's not saved from the OrderSend)
  3. What are Function return values ? How do I use them ? - MQL4 forum
  4. Have you read the Book and learned the lessons? Right now you're talking gibberish and there is no common ground to communicate.
 
deVries:


Do you have more lines ???

What is ticket ??? What is ticket1 ???

Is your broker using 4 digits for displaying price EURUSD ?? Is your openingprice> Bid? Is it allowed to place your buystop at that price ??

What errors do you see compiling your program in the MetaEditor....?

Use SRC Button to post your code....

 

hello devries sorry i will put the full code again and i will answer on your question:

i ddn't have more lines and i defined ticket, i compiled the code and i did't have an error but the problem is:

i tried the code on the strategie tester and the result is : 1 only buystop at price 1.2550 but should i want the programm to repeat the order when the last order closed at price 1.2255 "sure after the openigprice will >bid"

well my problem is: What do I do to make my program to repeat the order many time when the last ticket closed and the openigprice>bid?

thank you a lot.

#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
int ticket;
int start()

{
double y=1.2250;

ticket=OrderSend("EURUSD",OP_BUYSTOP,0.1,y,0,0,y+5*Point,0,0);

if(ticket>1)

OrderDelete(ticket);
return;
}
 
georgioooo:

hello devries sorry i will put the full code again and i will answer on your question:

i ddn't have more lines and i defined ticket, i compiled the code and i did't have an error but the problem is:

i tried the code on the strategie tester and the result is : 1 only buystop at price 1.2550 but should i want the programm to repeat the order when the last order closed at price 1.2255 "sure after the openigprice will >bid"

well my problem is: What do I do to make my program to repeat the order many time when the last ticket closed and the openigprice>bid?

thank you a lot.


//+------------------------------------------------------------------+
//|                                              buysell10points.mq4 |
//|                               Copyright © 2012,  Tjipke de Vries |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

extern double OrderOpenPriceBuy = 1.2250;
extern double Lots = 0.1;
extern string ExpertComment = "EAname";
extern int    Magic = 454545;
extern int    Slippage.Pips    = 3;
extern double TakeProfit = 5;


int trade = 0;
//++++ These are adjusted for 5 digit brokers.
int     pips2points;    // slippage  3 pips    3=points    30=points
double  pips2dbl;       // Stoploss 15 pips    0.015      0.0150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
//---


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   if (Digits % 2 == 1)  // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
     {pips2dbl = Point*10; pips2points = 10;   Digits.pips = 1;}
     else {pips2dbl = Point;    pips2points =  1;   Digits.pips = 0;}
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl       
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   int ticket;
   
   
   if(trade==0)
     {
      ticket=OrderSend("EURUSD",OP_BUYSTOP,Lots,OrderOpenPriceBuy,Slippage.Pips * pips2points,0,OrderOpenPriceBuy+TakeProfit*pips2dbl,ExpertComment,Magic,0,Green);
          if(ticket>0)
            {
             if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) 
               {
                Print("New BUYSTOP trade opened : ",OrderOpenPrice());
                trade=ticket;
               }
              else Print("Error opening NEW BUYSTOP trade : ",GetLastError()); 
             }
     }

    //OrderDelete(ticket);   You're trying to open a buy stop and immediately delete it? 

  
//----
   return(0);
  }
//+------------------------------------------------------------------+
 

deVries:

hello :) i want to thank you for your interest and for your time but devries when i run your code and my code in the tester strategie i found the same result, the two codes gave:

1 buystop at 1.2250 and when The system complete the process successfully he don't repeat the same order at 1.2250 when the the askprice Become below the level 1.2250 again.

//

ticket=OrderSend("EURUSD",OP_BUYSTOP,0.1,y,0,0,y+5*Point,0,0);

if(ticket>1)

OrderDelete(ticket); // i put orderDelete(ticket) when the number of ticket become higher than 1 "the server take only the first ticket and Refuses the others"

//

thank you deVries.

 
georgioooo:


insert the count of open trades of your EA..

If the count of open trades is zero then make

trade = 0;

for you to trie first

(by the way ticket is not giving the count of your trades it can be 12344556 while there is just one open)

 
deVries:


insert the count of open trades of your EA..

If the count of open trades is zero then make

for you to trie first

(by the way ticket is not giving the count of your trades it can be 12344556 while there is just one open)


i fixed the problem i want to thank you devries :) and I hope to remain in contact :)
Reason: