Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


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 (2) Thread Tools Display Modes
  #781 (permalink)  
Old 09-04-2007, 05:08 PM
Member
 
Join Date: Apr 2006
Posts: 76
ejoi is on a distinguished road
PHP Code:

int Account 
123456//change this to yor acc number

if (Account != AccountNumber())
{
Comment("You can not use this program with this account");
return (
0);
}
else
{
Comment("Welcome to Program");

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #782 (permalink)  
Old 09-04-2007, 06:53 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Yes, it will. If you don't need to run any code at the first time you attach the EA (init) or de-attach the EA (deinit).

Quote:
Originally Posted by n7drazen View Post
Will the expert advisor run normally without init() and deinit() functions?
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #783 (permalink)  
Old 09-04-2007, 06:54 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
What do you mean?

Quote:
Originally Posted by RBK1959 View Post
I want to know why the function 'AccountNumber()' is not returning the
correct value or any value for a second or two.

int Account = 123456;

if (Account != AccountNumber())
{
Comment("You can not use this program with this account");
return (0);
}
else
{
Comment("Welcome to Program");
}

Thanks
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #784 (permalink)  
Old 09-04-2007, 07:35 PM
Junior Member
 
Join Date: Apr 2006
Posts: 13
RBK1959 is on a distinguished road
Lag

When I put on the protection with the right machine number it first says that the program is invalid with this number then a few seconds later it kicks in and says it is valid.

Thanks
Rich
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #785 (permalink)  
Old 09-05-2007, 04:30 AM
Junior Member
 
Join Date: Aug 2007
Posts: 17
fxgroup is on a distinguished road
To CodersGuru : Need help to Close Position...

To CodersGuru : Need help to Close Position.... ( 2nd post )

Hi CodersGuru,
This is the second post asking you and may be you quite busy right now.
So sorry for disturbing you for a second time. First time, I am learning is EuroX2_sl, extended from 10 points 3 EA script. After did a few forward test, this EA did Open Position okay but it did not Close Position as I need to when market reverse ( after setting indicator ). Maybe, something is wrong with the code ( cos' I am not a programmer ) and I think I need your help to solve it. Could please check which part may be wrong ?

Condition is :
1. OPEN BUY when indicator condition exist. ie: stochastic
2. CLOSE BUY when OPEN SELL indicator exist. ie:stochastic
3. OPEN SELL as the indicator condition ( no. 2 above ) exist. ie : stochastic
4. CLOSE SELL as the indicator condition ( no. 1 above ) exist. ie : stochastic

I think OPEN position is okay but the problem is with the CLOSE POSITION as it did not CLOSE ( BUY or SELL ) even when the indicator exist.

The code as I did is :

-------- part of script from EuroX2_sl extended from 10 points 3 as I think for close position -------

// it is important to enter the market correctly,
// but it is more important to exit it correctly...
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // check for opened position


OrderSymbol()==Symbol()) // check for symbol
{
//+--------------------------------------------------------------


if(OrderType()==OP_BUY) // long position is opened
{
//+-------------------------------------------------------------------
//+ CONDITION FOR CLOSE POSITION
//+-------------------------------------------------------------------

//+--------------- CLOSE BUY POSITION ----------------------------
if ( Stoch_Main_M15_Cu < Stoch_Sig_M15_Cu )

//+------------------------------------------------------------------
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet) ; // close position
return(0); // exit
}
//+-----------------------------------------------------------------------
// check for trailing stop
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}
//+---------------CLOSE SELL POSITION --------------------------------
else // go to short position
{ //+ DO NOT REMOVE

if(OrderType()==OP_SELL) // short position is opened
{
}
// should it be closed?
//+----------------------------------------------------------------------------
if ( Stoch_Main_M15_Cu > Stoch_Sig_M15_Cu )

//+-----------------------------------------------------------------------------
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet) ; // close position
return(0); // exit
}
//+----------------------------------------


// check for trailing stop
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}

--------------------------------------------------------------

Thank you,
fxgroup
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #786 (permalink)  
Old 09-05-2007, 04:00 PM
Junior Member
 
Join Date: Apr 2006
Posts: 13
RBK1959 is on a distinguished road
Lag

Quote:
Originally Posted by codersguru View Post
What do you mean?
Codersguru..the code you gave us for protection. I used your code exactly on your page. What happens is "you can not use this program with this account" comes up for a few seconds before "Welcome to the program" when the right account number is in the code.

Thanks
Rich
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #787 (permalink)  
Old 09-05-2007, 06:30 PM
Junior Member
 
Join Date: Jun 2007
Posts: 3
xfiles is on a distinguished road
Alert MTF HAS

Hi codersguru,

I found this great article "Alert Once Per Bar" and I tried to make it works with 8 MTF HAS , but unfortunately I dont know how to do it, can you please add sound alert and popout window then signal shows up.

Thank you for your help!
Attached Images
File Type: jpg usdjpy_15.jpg (111.9 KB, 134 views)
Attached Files
File Type: mq4 8 TF HAS.mq4 (10.4 KB, 26 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #788 (permalink)  
Old 09-05-2007, 10:59 PM
ayejkt's Avatar
Junior Member
 
Join Date: Jul 2007
Posts: 4
ayejkt is on a distinguished road
Draw 2 indicator in one window

Hi All Programmer

How can i draw 2 indicator in one window, ie rsi and stochastic ?

Regards
aye
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #789 (permalink)  
Old 09-06-2007, 01:09 AM
increase's Avatar
Senior Member
 
Join Date: May 2006
Posts: 690
increase is on a distinguished road
Quote:
Originally Posted by ayejkt View Post
Hi All Programmer

How can i draw 2 indicator in one window, ie rsi and stochastic ?

Regards
aye
You can open one and then drag the other into the same window if they are sub windows, then you get 2 in one

If they are main window then you can combine them with code but it is tricky
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #790 (permalink)  
Old 09-06-2007, 02:10 AM
increase's Avatar
Senior Member
 
Join Date: May 2006
Posts: 690
increase is on a distinguished road
Is there a way to show which template you have loaded on a chart?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
histogram, forex, ZUP_v1.mq4

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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
Posted By For Type Date
OzFx System:) - Page 639 This thread Refback 06-21-2008 10:53 PM
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 12:46 PM


All times are GMT. The time now is 04:18 AM.



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