Forex
Google
New signals service!

Go Back   Forex Trading > Programming > Metatrader Programming


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1011 (permalink)  
Old 06-10-2008, 06:40 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 475
Blog Entries: 1
IN10TION is on a distinguished road
change these...

so, all the conditions are false and stay false till the if() conditions are true.
Remove the StopLong & StopSell in "double", every other "double" can stay.
This will do it for you!

bool BuyCondition=false;
bool SellCondition=false;
bool StopLong=false;
bool StopSell=false;

if((BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE) && (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE)) {BuyCondition=true;}
if((SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE) && (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE) && (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE)) {SellCondition=true;}
if((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE)) {StopLong=true;}
if((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE)) {StopSell=true;}



Quote:
Originally Posted by payback View Post
ok ok ok!
here is more!
PHP Code:
double
         BuyValueCurrent
,
         
SellValuePrevious,
         
SellValueCurrent,
         
         
BuyValuePrevious2,
         
BuyValueCurrent2,
         
SellValuePrevious2,
         
SellValueCurrent2,
         
BuyValueCurrent1min,
         
BuyValueCurrent5min,
         
BuyValueCurrent21min,
         
BuyValueCurrent25min,
         
SellValueCurrent1min,
         
SellValueCurrent5min,
         
SellValueCurrent21min,
         
SellValueCurrent25min,
         
         
TrendEnvUp,
         
TrendEnvDown,
         
TrendEnvUp1min,
         
TrendEnvUp5min,
         
TrendEnvDown1min,
         
TrendEnvDown5min,
         
        
Compra,
         
Vendi,
         
StopLong,
         
StopSell
the icustom funcions and buy sell

PHP Code:

 BuyValuePrevious  
iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,2);
   
BuyValueCurrent iCustom(NULL,0,IndicatorName1,NumBars,1,0);  
   
   
BuyValuePrevious2  iCustom(NULL,TimeFrame,IndicatorName2,NumBars,0,2);  
   
BuyValueCurrent2 iCustom(NULL,0,IndicatorName2,NumBars,0,0);  
   
   
SellValuePrevious iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);
   
SellValueCurrent  iCustom(NULL,0,IndicatorName1,NumBars,0,0);
   
   
SellValuePrevious2 iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);  
   
SellValueCurrent2 iCustom(NULL,0,IndicatorName2,NumBars,1,0);  
   
   
BuyValueCurrent1min iCustom(NULL,1,IndicatorName1,NumBars,1,0);
   
BuyValueCurrent5min iCustom(NULL,5,IndicatorName1,NumBars,1,0);
   
BuyValueCurrent21min iCustom(NULL,1,IndicatorName2,NumBars,0,0);
   
BuyValueCurrent25min iCustom(NULL,5,IndicatorName2,NumBars,0,0);
   
SellValueCurrent1min  iCustom(NULL,1,IndicatorName1,NumBars,0,0);
   
SellValueCurrent5min  iCustom(NULL,5,IndicatorName1,NumBars,0,0);
   
SellValueCurrent21min iCustom(NULL,1,IndicatorName2,NumBars,1,0);
   
SellValueCurrent25min iCustom(NULL,5,IndicatorName2,NumBars,1,0);
   
   
   
   
TrendEnvUp         iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0); // trendenvelopes 
   
TrendEnvDown         iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0); // trendenvelopes 
   
TrendEnvUp1min         iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);
   
TrendEnvUp5min         iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);
   
TrendEnvDown1min         iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);
   
TrendEnvDown5min         iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);
   
   
   
   
BuyCondition    = (BuyValueCurrent !=&& BuyValueCurrent2 !=&& TrendEnvUp != EMPTY_VALUE)&& (BuyValueCurrent1min !=&& BuyValueCurrent21min !=&& TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=&& BuyValueCurrent25min !=&& TrendEnvUp5min != EMPTY_VALUE) ;
   
SellCondition     = (SellValueCurrent !=&& SellValueCurrent2 !=&& TrendEnvDown != EMPTY_VALUE)&& (SellValueCurrent1min != && SellValueCurrent21min != && TrendEnvDown1min != EMPTY_VALUE)&& (SellValueCurrent5min != && SellValueCurrent25min != && TrendEnvDown5min != EMPTY_VALUE) ;
   
StopLong  = ((SellValueCurrent !=&& SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE));
   
StopSell  = ((BuyValueCurrent !=&& BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE)); 
the exit condition

PHP Code:


StopBuy  
= (SellValueCurrent !=&& SellValueCurrent2 !=|| TrendEnvDown != EMPTY_VALUE);
StopSell  = (BuyValueCurrent !=&& BuyValueCurrent2 !=|| TrendEnvUp != EMPTY_VALUE); 

Last edited by IN10TION; 06-10-2008 at 06:46 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1012 (permalink)  
Old 06-10-2008, 07:16 PM
Junior Member
 
Join Date: May 2008
Posts: 26
payback is on a distinguished road
thanks i will try this evening!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1013 (permalink)  
Old 06-10-2008, 07:19 PM
Junior Member
 
Join Date: May 2008
Posts: 26
payback is on a distinguished road
one stupid question everything inside the {} is your comment or i have to write it? and why? why {;} and not {}; ?
also can i still use this statment right?

PHP Code:
if(SellCondition)
      {
         
ticket        subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order
         
subCheckError(ticket,"SELL");
         
LastTrade     "SELL";
         return(
0); 

or i have to write:

PHP Code:
if(SellCondition true)
      {
         
ticket        subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order
         
subCheckError(ticket,"SELL");
         
LastTrade     "SELL";
         return(
0); 

Last edited by payback; 06-10-2008 at 07:35 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1014 (permalink)  
Old 06-10-2008, 08:11 PM
Junior Member
 
Join Date: Oct 2006
Posts: 12
forexcel is on a distinguished road
Help Needed to code a simple ea, please...

Hello All,

I'd like to thank everyone who has help me in the past. Righ now, i have a new request.
Can someone help me code this ea and here are the parameters:

My ea is based on an doji bar and an inside bar.

For an Inside bar :

Place a BUY-STOP/BUY-LIMIT at the HIGH of the next bar
Place a SELL-STOP/SELL-LIMIT at the LOW of the next bar

Clarifications :
Inside Bar is bar 0 (zero)
The next Bar is where we going to to place buy and sell limit or stop
The bar after next is where the long or short will be triggered.

On a one hour chart, if we have an inside bar at 9 AM, then we place our BUY-STOP or LIMIT and SELL-Stop otr LIMIT at the high and low of the 10 AM bar. The long or shor will be triggered at the 11 AM bar providing that price goes higher or lower than the 10 AM bar.


For a Doji bar :

Place a BUY-STOP/BUY-LIMIT at the HIGH of the previous bar
Place a SELL-STOP/SELL-LIMIT at the LOW of the previou bar

Clarifications :
Doji Bar is bar 0 (zero)
The Previoust Bar or Bar before the doji bar is where we going to to place buy and sell limit or stop at the high and low.
The bar after the doji bar is where the long or short will be triggered.

On a one hour chart, if we have doji bar at 9 AM, then we place our BUY-STOP or LIMIT and SELL-Stop otr LIMIT at the high and low of the 8 AM bar. The long or shor will be triggered at the 10 AM bar providing that price goes higher or lower than the 8 AM bar.


...maybe, it's not that simple. If it was i would have done it 2 weeks ago.

Thanks in advance!

Best Regards,

forexcel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1015 (permalink)  
Old 06-10-2008, 09:30 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 475
Blog Entries: 1
IN10TION is on a distinguished road
these are not comments, this is code.
they are a part of your if() statement.

if(SellCondition){
...
return(0);
}

if(SellCondition==true){
...
return(0);
}

both statements are ok, you can use one of them...
but see that every if() statement close with }
it doesn't show in your code that you provide here.

other example:
if(a==b){c=1; d=2; return(0);}


Quote:
Originally Posted by payback View Post
one stupid question everything inside the {} is your comment or i have to write it? and why? why {;} and not {}; ?
also can i still use this statment right?

PHP Code:
if(SellCondition)
      {
         
ticket        subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order
         
subCheckError(ticket,"SELL");
         
LastTrade     "SELL";
         return(
0); 
or i have to write:

PHP Code:
if(SellCondition true)
      {
         
ticket        subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order
         
subCheckError(ticket,"SELL");
         
LastTrade     "SELL";
         return(
0); 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1016 (permalink)  
Old 06-10-2008, 09:56 PM
Junior Member
 
Join Date: May 2008
Posts: 26
payback is on a distinguished road
ahhhhh i understood perfectly thx!!!!
i reviewing my C from college it s the same
anyway many thxs!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1017 (permalink)  
Old 06-10-2008, 10:34 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 475
Blog Entries: 1
IN10TION is on a distinguished road
found some indicators to start with...
there is also an EA, but it doesn't perform so well I think, just did a quick test...
Attached Files
File Type: mq4 in&out.mq4 (3.9 KB, 4 views)
File Type: mq4 InsideBar.mq4 (2.9 KB, 2 views)
File Type: mq4 ButNakedbarTrading EA.mq4 (14.1 KB, 6 views)

Last edited by IN10TION; 06-10-2008 at 10:49 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1018 (permalink)  
Old 06-11-2008, 06:33 AM
Junior Member
 
Join Date: Apr 2008
Posts: 3
forexbachok is on a distinguished road
PLease code EA for me

Hey freinds,
i have some request for those who able to code this ea
The system look like this..
let say for the pair GJ around gmt 8 show current price is 200.00
therefore i need a breakout instant show for
buy stop 200.50
sells stop 199.50
with SL 30 pip and TP 50pip
and the ea works automatically after it smile..hehe

only GMT 8.....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1019 (permalink)  
Old 06-11-2008, 09:36 PM
Junior Member
 
Join Date: Feb 2008
Posts: 9
nirvana is on a distinguished road
3_level_zz_semafor

hi dear friends

Could you please add an popup audio alert when the 3rd is made

best regards .
nirvana
Attached Files
File Type: mq4 3_Level_ZZ_Semafor.mq4 (7.8 KB, 1 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1020 (permalink)  
Old 06-12-2008, 04:51 AM
Junior Member
 
Join Date: May 2008
Posts: 7
areon25 is on a distinguished road
Hi all..

can someone please help me how to combine several indicators become an EA??

Actully, i have indicators that are..
1. FX Sniper's MA
2. FX Sniper's LSMA
3. Slope Direction Line
4. Supertrend Audible Alert
5. Super_signals_v3

Sorry to say, i'm not good in programming
Here i attach the picture for BUY Condition


this for SELL Condition



Open BUY POST
When FX Sniper MA && FX Sniper LSMA && Supertrend Audible Alert = Green && Slope Direction Line = Blue.

Open SELL POST
When FX Sniper MA && FX Sniper LSMA && Supertrend Audible Alert && Slope Direction Line = Red.

Exit BUY/SELL POST
when super signal v3 appears.

hope someone can help me..

thanks


these are the indicators
1. FX Sniper's MA
FX Sniper MA.mq4

2. FX Sniper's LSMA
FX Sniper LSMA.mq4

3. Slope Direction Line
Slope Direction Line.mq4

4. Supertrend Audible Alert
Supertrend Audible Alert.mq4

5. Super_signals_v3
super_signals_v3.mq4

Last edited by areon25; 06-12-2008 at 04:56 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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 On
Forum Jump