Parabolic SAR code! - page 2

 
sadik:

Hello juan

can you tell us if it is good strategy, did it work for you?

Did you notice this ?  juanmanuel           2007.      10.26 05:15

Why are you asking about a   5   year old post ? 

 
RaptorUK:

Did you notice this ?  juanmanuel           2007.      10.26 05:15

Why are you asking about a   5   year old post ? 



Hello RaptorUK

actually i am new at this field, i am trying to program EA use parabolic SAR indicator

and behave like this:

open buy order when SAR change from above to below of candles, with fixed TP and SL

and close it if the SAR change its direction and didn't hit TP or SL

i did this till now: (but its not opening any order):

extern double Step    =0.02;   //Parabolic setting
extern double Maximum =0.2;    //Parabolic setting
extern double    Lots=1;
extern int       Slip=5;
extern int     flag1=0;

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+


int start()
  {
  //open order criteria
  
 if ((iSAR(NULL, 0,Step,Maximum, 0)<iClose(NULL,0,0))&&(iSAR(NULL, 0,Step,Maximum, 1)>iOpen(NULL,0,1)))  //Signal Buy
 {

   int opensell=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slip,NormalizeDouble(Bid+25*Point,Digits),NormalizeDouble(Bid-25*Point,Digits),"MY trader sell order",0,0,Green);
   flag1=1; 
 }
 
 if ((iSAR(NULL, 0,Step,Maximum, 0)>iClose(NULL,0,0))&&(iSAR(NULL, 0,Step,Maximum, 1)<iOpen(NULL,0,1)))  //Signal Sell
 {
 
   int openbuy=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip,NormalizeDouble(Ask-25*Point,Digits),NormalizeDouble(Ask+25*Point,Digits),"MY trader buy order",0,0,Blue);
   flag1=1;
 }

 
sadik:


Hello RaptorUK

actually i am new at this field, i am trying to program EA use parabolic SAR indicator

and behave like this:

open buy order when SAR change from above to below of candles, with fixed TP and SL

and close it if the SAR change its direction and didn't hit TP or SL

i did this till now: (but its not opening any order):

<CODE REMOVED>

Please edit your post . . .    please use the   SRC   button to post code: How to use the   SRC   button. 

 
sadik:


Hello RaptorUK

actually i am new at this field, i am trying to program EA use parabolic SAR indicator

and behave like this:

open buy order when SAR change from above to below of candles, with fixed TP and SL

and close it if the SAR change its direction and didn't hit TP or SL

i did this till now: (but its not opening any order):

Why not ?  is the OrderSend failing ?  why aren't you checking the return value from the OrderSend() to see if it has failed ?  Read this: What are Function return values ? How do I use them ?

Does your OrderSend() get called ?  are you printing the values of the following . . . 

iSAR(NULL, 0,Step,Maximum, 0)  iClose(NULL,0,0)    iSAR(NULL, 0,Step,Maximum, 1)   iOpen(NULL,0,1)

 so you know if your conditions to place a trade are met ?  why not ?

 
RaptorUK:

Why not ?  is the OrderSend failing ?  why aren't you checking the return value from the OrderSend() to see if it has failed ?  Read this: What are Function return values ? How do I use them ?

Does your OrderSend() get called ?  are you printing the values of the following . . . 

 so you know if your conditions to place a trade are met ?  why not ?


thanks for your help :)
Reason: