Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-06-2009, 11:01 AM
Member
 
Join Date: Sep 2008
Posts: 33
silumancumi is on a distinguished road
Thumbs up Parabolic sar based ea

Hi everyone,

I'm just a newbie in EA realm... and i'm sorry for my english.. i'm from Indonesia.

i'd like to ask for help in this great forum... i made this EA a couple weeks ago.. it's based on Parabolic SAR in multi time frame.. but i need to change the rule...

In previous rule, the EA waits for all PSAR in all time frame to be the same in direction and the signal for OP comes from direction change in smallest Time Frame.

In current rule, the EA still wait for all PSAR in all time frame to be the same in direction BUT the signal for OP come from any Time Frame. Meaning: Whenever All the PSAR has same direction the EA will take position.

You may want to take a look at my thread of this EA HERE

The EA needs to be changed because current rule will be more promising. Could somebody please help check my code in post #3 bellow? I have forward tested but no OP at all, i don't know what's wrong.

PSAR_EA_02 (Feb05) is coded with previous rule
EA PASAR CUMI v.2 is with current rule (but i'm sure there's something wrong in my coding)

Thanx in advance.

[IMG][/IMG]
Attached Files
File Type: mq4 PSAR_EA_02 (Feb05).mq4 (9.7 KB, 366 views)
File Type: mq4 EA PASAR CUMI V.2.mq4 (9.9 KB, 308 views)

Last edited by silumancumi; 02-06-2009 at 11:45 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 02-06-2009, 11:08 AM
Member
 
Join Date: Sep 2008
Posts: 33
silumancumi is on a distinguished road
These are screenshots to ilustrate the logic behind the CURRENT RULE, i'm sorry if it's too big.
The green-red bar is Par SAR, take position whenever all the bars have same colour.

[IMG][/IMG]

[IMG][/IMG]

[IMG][/IMG]

[IMG][/IMG]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 02-06-2009, 11:38 AM
Member
 
Join Date: Sep 2008
Posts: 33
silumancumi is on a distinguished road
EA PASAR CUMI V.2 (current rule), could somebody please tell me what's wrong?
Code:
extern double Lots=1;
extern int StopLoss=40;
extern int TakeProfit=20;
extern string txComment="Order PSAR";
extern int MagicNumber=12345;
extern int Slippage=3;
extern int MaxOrders=5;

//Parameter TF0
extern string  note1     = "--- Parameter PSar 1 ---";
extern int     TF0      =  1;
extern double  step0    =  0.005;
extern double  maximum0 = 0.2;
//end

//Parameter TF1
extern string  note2     = "--- Parameter PSar 2 ---";
extern int     TF1      =  5;
extern double  step1    =  0.005;
extern double  maximum1 = 0.2;
//end

//Parameter TF2
extern string note3     = "--- Parameter PSar 3 ---";
extern int     TF2      =  15;
extern double  step2    =  0.005;
extern double  maximum2 = 0.2;
//end

//Parameter TF3
extern string note4     = "--- Parameter PSar 4 ---";
extern int     TF3      =  30;
extern double  step3    =  0.005;
extern double  maximum3 = 0.2;
//end

//Parameter TF4
extern string note5     = "--- Parameter PSar 5 ---";
extern int     TF4      =  60;
extern double  step4    =  0.005;
extern double  maximum4 = 0.2;
//end

//Parameter TF5
extern string note6     = "--- Parameter PSar 6 ---";
extern int     TF5      =  240;
extern double  step5    =  0.005;
extern double  maximum5 = 0.2;
//end

/*
Minor update by metropolis:
Trailing stop function 
5 digits broker issues fixed 
one signal for one position
*/
extern int TrailingStop =0;

///////////////////////////////////////
datetime bartime=0;
int tiket;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {  
      ////////////////////////////// 1st Previous Trend ; 1 means Bullish ; 0 means Bearish ///////////////////////////
      
      //// Bullish ////
      if (iSAR(NULL,TF0,step0,maximum0,1)<Close[0])   {int TrendP1_0 = 1; string TrendP1_0s="Bullish";}               
      if (iSAR(NULL,TF1,step1,maximum1,1)<Close[0])   {int TrendP1_1 = 1; string TrendP1_1s="Bullish";}         
      if (iSAR(NULL,TF2,step2,maximum2,1)<Close[0])   {int TrendP1_2 = 1; string TrendP1_2s="Bullish";}         
      if (iSAR(NULL,TF3,step3,maximum3,1)<Close[0])   {int TrendP1_3 = 1; string TrendP1_3s="Bullish";}         
      if (iSAR(NULL,TF4,step4,maximum4,1)<Close[0])   {int TrendP1_4 = 1; string TrendP1_4s="Bullish";}         
      if (iSAR(NULL,TF5,step5,maximum5,1)<Close[0])   {int TrendP1_5 = 1; string TrendP1_5s="Bullish";} 
      
      //// Bearish ////     
      if (iSAR(NULL,TF0,step0,maximum0,1)>Close[0])       {TrendP1_0 = 0; TrendP1_0s="Bearish";}       
      if (iSAR(NULL,TF1,step1,maximum1,1)>Close[0])       {TrendP1_1 = 0; TrendP1_1s="Bearish";}       
      if (iSAR(NULL,TF2,step2,maximum2,1)>Close[0])       {TrendP1_2 = 0; TrendP1_2s="Bearish";}      
      if (iSAR(NULL,TF3,step3,maximum3,1)>Close[0])       {TrendP1_3 = 0; TrendP1_3s="Bearish";}      
      if (iSAR(NULL,TF4,step4,maximum4,1)>Close[0])       {TrendP1_4 = 0; TrendP1_4s="Bearish";}      
      if (iSAR(NULL,TF5,step5,maximum5,1)>Close[0])       {TrendP1_5 = 0; TrendP1_5s="Bearish";} 
      
     
      ///////////////////////////////// 2nd Previous Trend ; 1 means Bullish ; 0 means Bearish /////////////////////////
      
      //// Bullish ////
      if (iSAR(NULL,TF0,step0,maximum0,2)<Close[0])   {int TrendP2_0 = 1;}             
      if (iSAR(NULL,TF1,step1,maximum1,2)<Close[0])   {int TrendP2_1 = 1;}      
      if (iSAR(NULL,TF2,step2,maximum2,2)<Close[0])   {int TrendP2_2 = 1;}      
      if (iSAR(NULL,TF3,step3,maximum3,2)<Close[0])   {int TrendP2_3 = 1;}      
      if (iSAR(NULL,TF4,step4,maximum4,2)<Close[0])   {int TrendP2_4 = 1;}      
      if (iSAR(NULL,TF5,step5,maximum5,2)<Close[0])   {int TrendP2_5 = 1;}      
      
      //// Bearish ////
      if (iSAR(NULL,TF0,step0,maximum0,2)>Close[0])       {TrendP2_0 = 0;}      
      if (iSAR(NULL,TF1,step1,maximum1,2)>Close[0])       {TrendP2_1 = 0;}      
      if (iSAR(NULL,TF2,step2,maximum2,2)>Close[0])       {TrendP2_2 = 0;}      
      if (iSAR(NULL,TF3,step3,maximum3,2)>Close[0])       {TrendP2_3 = 0;}      
      if (iSAR(NULL,TF4,step4,maximum4,2)>Close[0])       {TrendP2_4 = 0;}      
      if (iSAR(NULL,TF5,step5,maximum5,2)>Close[0])       {TrendP2_5 = 0;}
      
      string Signal = "NONE";
      static string LastSignal = "NONE"; 
                 
      ///////////////////////////// 1st previous Signal ////////////////////////////
       
      if (TrendP1_0==1 && TrendP1_1==1 && TrendP1_2==1 && TrendP1_3==1 && TrendP1_4==1 && TrendP1_5==1)
         {int TrendP1=1;}     //All 1st prev Bullish
         else if (TrendP1_0==0 && TrendP1_1==0 && TrendP1_2==0 && TrendP1_3==0 && TrendP1_4==0 && TrendP1_5==0)
                 {TrendP1=0;} //All 1st prev Bearish
                 
     ///////////////////////////// 2nd previous Signal  ////////////////////////////  
                     
      if (TrendP2_0==1 && TrendP2_1==1 && TrendP2_2==1 && TrendP2_3==1 && TrendP2_4==1 && TrendP2_5==1)
         {int TrendP2=1;}     //All 2nd prev Bullish
          else if (TrendP2_0==0 && TrendP2_1==0 && TrendP2_2==0 && TrendP2_3==0 && TrendP2_4==0 && TrendP2_5==0)
                  {TrendP2=0;} //All 2nd prev Bearish
                       
         
      ////////////////////////////// Open Position ///////////////////////////// 
       
      if (OrdersTotal()<MaxOrders && bartime != Time[0])
      
         {if (TrendP1==1 && TrendP2!=0 && TrendP2!=1) /// if 1st previous ALL bullish, and 2nd previos NOT ALL same signal
             {Signal = "LONG (BUY)";
              LastSignal = Signal;           
              tiket = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*pointt(),Ask+TakeProfit*pointt(),txComment,MagicNumber,0,Green); 
              if(tiket>0) bartime = Time[0];}
      
           else if 
             (TrendP1==0 && TrendP2!=0 && TrendP2!=1) /// if 1st previous ALL bearish, and 2nd previous NOT ALL same signal
             {Signal = "SHORT (SELL)";
              LastSignal = Signal;
              tiket = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid+StopLoss*pointt(),Bid-TakeProfit*pointt(),txComment,MagicNumber,0,Red);
              if(tiket>0) bartime = Time[0];}
      
      }
      
      Comment("n",  
         "n     EA PASAR CUMI V.2",
         "n",     
         "n","     Broker time= ",TimeToStr(TimeCurrent()),
         "n",
         "n","     Trend TF ",(TF0)," M = ",(TrendP1_0s),
         "n","     Trend TF ",(TF1)," M = ",(TrendP1_1s),
         "n","     Trend TF ",(TF2)," M = ",(TrendP1_2s),
         "n","     Trend TF ",(TF3)," M = ",(TrendP1_3s),
         "n","     Trend TF ",(TF4)," M = ",(TrendP1_4s),
         "n","     Trend TF ",(TF5)," M = ",(TrendP1_5s),
         "n","     Last Signal    = ",(LastSignal),
         "n","     Current Signal = ",(Signal),
         "n",
         "n","     Equity = ",AccountEquity());
         
            
      //////////Trailing Stop is here//////////////
      for (int i = 0; i < OrdersTotal(); i++)
      {
         OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && TrailingStop>0)
         {
            if(OrderType()==OP_BUY)
            {
               if(Bid-OrderOpenPrice()>pointt()*TrailingStop)
               {
                  if(OrderStopLoss()<Bid-pointt()*TrailingStop || (OrderStopLoss()==0))
                  {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-pointt()*TrailingStop,OrderTakeProfit(),0,CLR_NONE);
                     return(0);
                  }
               }
            }
         
            if(OrderType()==OP_SELL)
            {
               if((OrderOpenPrice()-Ask)>(pointt()*TrailingStop))
               {
                  if((OrderStopLoss()>(Ask+pointt()*TrailingStop)) || (OrderStopLoss()==0))
                  {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+pointt()*TrailingStop,OrderTakeProfit(),0,CLR_NONE);
                     return(0);
                  }
               }      
            }
         } 
      
      }   
      
   return(0);
  }
//+------------------------------------------------------------------+

double pointt()
{
   if(Digits==2) return(0.01);
   if(Digits==4) return(0.0001);
   if(Digits==5 || Digits==3) return(0.00001);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 02-19-2009, 09:29 AM
luckytea's Avatar
Junior Member
 
Join Date: Jul 2007
Posts: 5
luckytea is on a distinguished road
Modifications

Sorry... I've modified this EA, if it's not correct yet. If it's not satisfy enough, please tell me....
Attached Files
File Type: mq4 EA PASAR CUMI V.2.mq4 (10.4 KB, 281 views)

Last edited by luckytea; 02-24-2009 at 05:51 AM. Reason: Languange it's not english
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 02-20-2009, 02:43 AM
Linuxser's Avatar
User Root
 
Join Date: May 2006
Location: Helliconia (Winter)
Posts: 4,410
Blog Entries: 56
Linuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond reputeLinuxser has a reputation beyond repute
Quote:
Originally Posted by luckytea View Post
kalo masih ada yang kurang bener, kasi tau saya ya....
English please...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 02-20-2009, 03:22 AM
Junior Member
 
Join Date: Feb 2009
Posts: 2
jebng is on a distinguished road
siumancumi

Any luck with your EA?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 02-26-2009, 03:18 PM
Junior Member
 
Join Date: Oct 2006
Posts: 5
Everett is on a distinguished road
Can you please provide para 4tf indicator so that ea can be tested.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #8 (permalink)  
Old 02-28-2009, 12:49 PM
Senior Member
 
Join Date: Mar 2008
Posts: 426
ChicagoRob is on a distinguished road
Quote:
Originally Posted by Everett View Post
Can you please provide para 4tf indicator so that ea can be tested.
Yes, I would like that, too. Looks like this could make for a good
manual system.

Rob
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #9 (permalink)  
Old 03-01-2009, 04:39 PM
Member
 
Join Date: Oct 2007
Location: USA
Posts: 37
traderlab is on a distinguished road
Quote:
Originally Posted by ChicagoRob View Post
Yes, I would like that, too. Looks like this could make for a good
manual system.

Rob
Try this,hope it helps.regards
Attached Files
File Type: mq4 4 TF PSAR Bar2.mq4 (8.7 KB, 185 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #10 (permalink)  
Old 03-01-2009, 04:44 PM
Member
 
Join Date: Oct 2007
Location: USA
Posts: 37
traderlab is on a distinguished road
Voice alert on MTF psar

Greetings to all, Can someone make a voice alert (both buy and sell) with arrows on the attached indicator when all blue or red are in the same direction?
Thanking you in advance
Attached Files
File Type: mq4 4 TF PSAR Bar2.mq4 (8.7 KB, 134 views)

Last edited by traderlab; 03-01-2009 at 04:49 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EA based on parabolic SAR... but still unperfect white_tiger Expert Advisors - Metatrader 4 19 11-26-2008 11:47 AM
Parabolic SAR marcf Documentation 4 05-11-2007 12:14 PM
Parabolic nnjeim General Discussion 1 08-27-2006 08:43 PM
Parabolic Sar and MAs EA DAZLER Suggestions for Trading Systems 1 06-30-2006 05:32 AM
EA for Parabolic Sar needed hoosain Suggestions for Trading Systems 2 04-19-2006 10:53 AM


All times are GMT. The time now is 08:50 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.