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 (1) Thread Tools Display Modes
  #341 (permalink)  
Old 09-09-2007, 01:06 PM
Senior Member
 
Join Date: Oct 2005
Posts: 114
jimmyking is on a distinguished road
How to run a script inside a EA?

Hi,

I'd like to know how to run a script in script dirctory within a EA.

If (condition true)
{
Run Script;
}

Thx in advance
Regards

Jimmy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #342 (permalink)  
Old 09-10-2007, 04:09 PM
Junior Member
 
Join Date: Aug 2007
Posts: 5
yarns90401 is on a distinguished road
Fast order creation

I'm monitoring several charts and when I see a good trade entry point I'd like to create an order as quickly as possible without using the dialog box. What would you suggest?

Thanks in advance,

Ed
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #343 (permalink)  
Old 09-10-2007, 04:11 PM
Junior Member
 
Join Date: Oct 2006
Posts: 24
natsirte is on a distinguished road
Is it possible , two EA in the same time?

Hi evrerybody

Is it possible to make working my two EA?
- in the same time
- in the same Timeframe (ex : 1 minute)
- and with the same Currency Pair (ex :EUR/USD)


I've change the MagicNumber (EA_1 = 10 ; EA_2 = 20) but they're working one after another even if, the conditons for a trade are good for each .

Help me please.

Thanks!
Attached Files
File Type: mq4 EA_1.mq4 (9.2 KB, 29 views)
File Type: mq4 EA_2.mq4 (9.2 KB, 17 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #344 (permalink)  
Old 09-10-2007, 08:34 PM
Member
 
Join Date: Sep 2006
Posts: 59
waaustin is on a distinguished road
Quote:
Originally Posted by ralph.ronnquist View Post
Hmm; I didn't trial your EA, but by reading the logic, it looks to me like the only thing stopping a subsequent Sell after a Buy is that "IsTrade" is true. (Except that it won't open a Sell at the very same time as it opens a Buy)
So if you want the Sell logic to apply unconditionally, I would have thought that my edit (1) only -- forget 2-4 -- would do the trick. Or remove the "IsTrade" logic.

Though, there's the subordinate logic with "TickCheck" and "BarCount", which stops another trade at the same tick or at the same bar, but I assume you want that to apply still.

Of course I can't say much about the signaling part, which you omitted. E.g., if raising a "Sell_Signal" takes account of "BuyOrders", then there's more to do.

Hello,

Thanks again for your time. Just for your info, I resolved the issue. Your suggested modification was the first step in the right direction. It needed on additional modification (in bold type) as follows:

if (Buy_Signal && BuyOrders < Max_Buys && BuyOrders==0) Order = SIGNAL_BUY;
if (Sell_Signal && SellOrders < Max_Sells && SellOrders==0) Order = SIGNAL_SELL;


Thanks again. Perhaps, if you don't mind you could help me with one other question. I would like to add the EA to have the flexibility to close any open order after X number of days, where X is adjustable in the expert setup dialog. So, say a buy trade opens on a certain date and time, be able to close the trade three days later at the same time of day?

Any ideas or suggestions is appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #345 (permalink)  
Old 09-10-2007, 10:20 PM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
You might put this code after the "BuyOrders++;" line:
PHP Code:
if ( TimeCurrent() - OrderOpenTime() >= 86400 MaxTradePeriodInDays )
    
Order SIGNAL_CLOSEBUY
and similar for the sell orders.

Doesn't do weekends well, though.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #346 (permalink)  
Old 09-11-2007, 12:10 AM
Junior Member
 
Join Date: Oct 2006
Posts: 11
Khamoosh is on a distinguished road
Indicator with this code:

Hi my Dears,

I want 2 indicators in MT4 with these code below: (with arrow signal buy/sell on the chart)

Number 1:
----------
MA1 = SMA(5,Close), MA2 = SMA(10,Close), MACD(12,26,9)
To signal a long trade: MA1 > MA2, RSI(14) > 50, and MACD Fast > MACD Signal
To signal a short trade: MA1 < MA2, RSI(14) < 50, and MACD Fast < MACD Signal.
----------

Number 2:
----------
F1 is Fractal Up Level and F2 is Fractal Down Level in the code below

UpTrend and DownTrend(Description):

F1:=ValueWhen(1,H<Ref(H,-2) AND Ref(H,-1)<Ref(H,-2) AND Ref(H,-3)<Ref(H,-2) AND Ref(H,-4)<Ref(H,-2),Ref(H,-2));
F2:=ValueWhen(1,L>Ref(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2),Ref(L,-2));
a:=Cross(H,F1);
b:=Cross(F2,L);
state:=BarsSince(a)<BarsSince(b);
{Signal Long and Short}
LongSignal:= state<Ref(state,-1);
ShortSignal:=state>Ref(state,-1);
{Trend Up and Down}
UpTrend:=state>0;
DownTrend:=state<1;
---------------------------------------

Thanks and Best Regards,
Khamoosh
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #347 (permalink)  
Old 09-11-2007, 02:38 AM
Dan7974's Avatar
Senior Member
 
Join Date: Jul 2006
Posts: 264
Dan7974 is on a distinguished road
Hours and Hours!!!!!!!

I really need help!
I do not get this at all!!!!!!!!!
I tried Mql4.com, F1 while selecting the word,everything!
I do not get it!!!!!!

What does
PHP Code:
IndicatorCounted() 
mean?????????


What does
PHP Code:
Bars 
mean??????????????


What is
PHP Code:
Bars-IndicatorCounted() 
mean????????????
__________________
God Bless Everyone, and their trading logic.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #348 (permalink)  
Old 09-11-2007, 04:01 AM
Senior Member
 
Join Date: Jan 2006
Posts: 392
nicesurf is on a distinguished road
You need what kind of help ? Indicators.." You can get some here..what you need now is to learn and practice,,he..he...he..
__________________
Nic
Free Forex Strategy Communication Items
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #349 (permalink)  
Old 09-11-2007, 04:32 AM
1Dave7's Avatar
Member
 
Join Date: Aug 2007
Posts: 82
1Dave7 is on a distinguished road
Thumbs up

Quote:
Originally Posted by Dan7974 View Post
I really need help!
I do not get this at all!!!!!!!!!
I tried Mql4.com, F1 while selecting the word,everything!
I do not get it!!!!!!

What does
PHP Code:
IndicatorCounted() 
mean?????????


What does
PHP Code:
Bars 
mean??????????????


What is
PHP Code:
Bars-IndicatorCounted() 
mean????????????

int IndicatorCounted( )
The function returns the amount of bars not changed after the indicator had been launched last. The most calculated bars do not need any recalculation. In most cases, same count of index values do not need for recalculation. The function is used to optimize calculating.

Note: The latest bar is not considered to be calculated and, in the most cases, it is necessary to recalculate only this bar. However, there occur some boundary cases where custom indicator is called from the expert at the first tick of the new bar. It is possible that the last tick of the previous bar had not been processed (because the last-but-one tick was being processed when this last tick came), the custom indicator was not called and it was not calculated because of this. To avoid indicator calculation errors in such situations, the IndicatorCounted() function returns the count of bars minus one.
Sample:
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- the last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- main loop
for(int i=0; i<limit; i++)
{
//---- ma_shift set to 0 because SetIndexShift called abowe
ExtBlueBuffer[i]=iMA(NULL,0,JawsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i) ;
ExtRedBuffer[i]=iMA(NULL,0,TeethPeriod,0,MODE_SMMA,PRICE_MEDIAN,i );
ExtLimeBuffer[i]=iMA(NULL,0,LipsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i) ;
}
//---- done
return(0);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #350 (permalink)  
Old 09-11-2007, 03:08 PM
Senior Member
 
Join Date: Feb 2006
Posts: 559
Michel is on a distinguished road
Quote:
Originally Posted by natsirte View Post
Hi evrerybody

Is it possible to make working my two EA?
- in the same time
- in the same Timeframe (ex : 1 minute)
- and with the same Currency Pair (ex :EUR/USD)


I've change the MagicNumber (EA_1 = 10 ; EA_2 = 20) but they're working one after another even if, the conditons for a trade are good for each .

Help me please.

Thanks!
Replace the line :
PHP Code:
if(OrderType() <= OP_SELL &&  OrderSymbol() == Symbol()) { 
by this one :
PHP Code:
if(OrderType() <= OP_SELL &&  OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) { 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
candle time, CHinGsMAroonCLK, coders guru, expert advisor, forex, how to code, I_XO_A_H, mechanical trading, trading

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/metatrader-programming/554-how-code.html
Posted By For Type Date
Need an experienced programmer? - Page 2 Post #0 Refback 09-24-2008 07:24 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 05:22 PM


All times are GMT. The time now is 12:09 PM.



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