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
  #291 (permalink)  
Old 07-22-2007, 05:04 PM
Senior Member
 
Join Date: Jan 2007
Location: not so remote
Posts: 2,242
fxbs is on a distinguished road
Dear Expert Advisors! pl. advise on refreshing buffers code

Dear Experts Advisors! Please give me advise on refreshing buffers (just good advise)


there is code (patch, fix, upgrade) by Raff 4 multitimeframe (MTF) indicators, working pretty good;
what could be similar code you can add to regular (not mtf) indicators?

If possible, please, give example,
thank you


//---- Refresh buffers +++++++++++++++++++++ upgrade by Raff
if (TimeFrame>Period()) {
int PerINT=TimeFrame/Period()+1;
datetime TimeArr[]; ArrayResize(TimeArr,PerINT);
ArrayCopySeries(TimeArr,MODE_TIME,Symbol(),Period( ));
for(i=0;i<PerINT+1;i++) {if (TimeArr[i]>=TimeArray[0]) {
//----
/************************************************** ***
Refresh buffers: buffer[i] = buffer[0];
************************************************** ****/

Buffer1[i]= Buffer1[0];
Buffer2[i]= Buffer2[0];
Buffer3[i]= Buffer3[0];

//----
} } }
//+++++++++++++++++++++++++++++++++++++++++ Raff ++++++
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #292 (permalink)  
Old 07-30-2007, 06:08 AM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Smile Code to Pause between actions in an EA Needed

What is the proper way to put a pause statement in an EA? Would it be the same for an indicator??

Dave
<><<<
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #293 (permalink)  
Old 07-30-2007, 06:21 AM
Member
 
Join Date: Feb 2006
Posts: 35
flexie is on a distinguished road
sleep(1000);

1000 is 1000 milliseconds, or 1 second.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #294 (permalink)  
Old 07-30-2007, 08:01 AM
Administrator
 
Join Date: Sep 2005
Posts: 16,817
Blog Entries: 145
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Small thread about it with code http://www.forex-tsd.com/metatrader-...-function.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #295 (permalink)  
Old 07-30-2007, 04:25 PM
Junior Member
 
Join Date: Jul 2007
Posts: 2
pentesileia is on a distinguished road
Question How to code this alert?

I'm trying to code a set of alerts including some RSI related, but actually i'm stuck at this point:



I slimply cant figure how to make the code to alert the point of re-entry in 30-70 RSI levels.

I would be very happy if someone could explain me how to do it.
Thank you for your time.

pente
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #296 (permalink)  
Old 07-30-2007, 04:59 PM
Administrator
 
Join Date: Sep 2005
Posts: 16,817
Blog Entries: 145
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
For information:
- RSI with alert is here http://www.forex-tsd.com/137631-post679.html
- everything about RSI is here: http://www.forex-tsd.com/setup-quest...indicator.html
- the other RSI with alert is in elite indicators' thread in elite section.

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

pentesileia,

I am not a coder but I know that it is something with two values of the indicator.
For example, we have i bar and i+1 bar (it is the same as 1st bar and 2nd bar).
So, RSI on i bar is below 70 and RSI of i+1 bar (previous bar) is above 70. It is the crossing. And opposite for 30 for example.
It is not difficult to code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #297 (permalink)  
Old 07-30-2007, 06:23 PM
Junior Member
 
Join Date: Jul 2007
Posts: 2
pentesileia is on a distinguished road
newdigital,

Thank you for your fast and wise answer!
I'm sure I'll be able to get my goal with such info.

pente
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #298 (permalink)  
Old 08-13-2007, 01:02 PM
Junior Member
 
Join Date: Aug 2007
Posts: 17
fxgroup is on a distinguished road
EA To Close Position By Indicator

//+---------------------------------------------
CLOSE POSITION BY INDICATOR
//+---------------------------------------------

if ( iCCI ( NULL, PERIOD_H1, 50, PRICE_TYPICAL, 1)

{
total = OrdersTotal();
for(int i=total-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
bool result = false;
switch(type)
{
case OP_BUY : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 1, Aqua ); break;
case OP_SELL : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 1, Tomato );
}
if (UseSound) PlaySound(NameFileSoundClose);
}
{
return(0);
}

//+--------------------- end of script --------------------------------

Hi,
Anyone could help me to solve this problem, when I compile the 2 errors occurs :

‘UseSound’ – variable not defined.
‘NameFileSoundClose’ – variable not defined.

What should I do ?

And,
I do not know whether this code is to CLOSE for OPEN SELL or OPEN BUY POSITION. How do I set the code for different INDICATOR to CLOSE for OPEN SELL and OPEN BUY POSITION.

Thank you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #299 (permalink)  
Old 08-18-2007, 04:59 PM
Junior Member
 
Join Date: Jan 2007
Posts: 7
fibofan is on a distinguished road
How to increase lot size after loss??

Does anyone know enough about programing an EA to help me out a little.
I have a pretty good EA but would like to have it increase the lot size only after a drop in equity or a loosing trade but I'm not sure how to program that in.

Can anyone give me some help??
Thanks!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #300 (permalink)  
Old 08-20-2007, 12:21 AM
Member
 
Join Date: Mar 2007
Posts: 32
Nordic12 is on a distinguished road
Chick Gosling

How can i create this code from metastock to MT4

factor:= 2.43;
sp:= 3;
ip:= 10;
lp:= 16;
sl:= (Mov(CLOSE,sp,S)-Mov(CLOSE,ip,S))/(((((Mov(CLOSE,ip,S)+factor*Mov(CLOSE,ip,S)
)*0.333)-Mov(CLOSE,ip,S))/100));
ml:= Mov(sl,lp,S);
ml;
sl;
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.