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
  #1281 (permalink)  
Old 09-19-2008, 05:06 PM
Junior Member
 
Join Date: May 2008
Posts: 5
i2trader is on a distinguished road
Here are the EA's I was talking about in the previous post. The one is Ema Cross and the other is 100 pips
Attached Files
File Type: mq4 100_pips_31.mq4 (5.2 KB, 0 views)
File Type: mq4 MA_CrossOver_EA.mq4 (6.1 KB, 3 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1282 (permalink)  
Old 09-20-2008, 06:30 PM
Junior Member
 
Join Date: May 2008
Posts: 5
i2trader is on a distinguished road
Paging MR PIP

I am new to this coding stuff. I was wondering how to replace this line of code with the LSMA. Could you help me with this task.

Trend = iMA(Symbol(), TrendTimeFrame, TrendPeriods, 0, MODE_LWMA, PRICE_CLOSE, 0);
// PrevTrend = iMACD(Symbol(), PERIOD_M1, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);

With this line of code from your LSMA_ MCAD_EMA mq4.


//+------------------------------------------------------------------------+
//| LSMA - Least Squares Moving Average function calculation |
//| LSMA_In_Color Indicator plots the end of the linear regression line |
//+------------------------------------------------------------------------+

double LSMA(int Rperiod, int shift)
{
int i;
double sum;
int length;
double lengthvar;
double tmp;
double wt;

length = Rperiod;

sum = 0;
for(i = length; i >= 1 ; i--)
{
lengthvar = length + 1;
lengthvar /= 3;
tmp = 0;
tmp = ( i - lengthvar)*Close[length-i+shift];
sum+=tmp;
}
wt = MathFloor(sum*6/(length*(length+1))/Point)*Point;

return(wt);
}




Or do I have to do something else to make this work?

Last edited by i2trader; 09-20-2008 at 06:45 PM. Reason: to clarify the statement.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1283 (permalink)  
Old 09-20-2008, 08:03 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
Kalenzo is on a distinguished road
Quote:
Originally Posted by i2trader View Post
I am new to this coding stuff. I was wondering how to replace this line of code with the LSMA. Could you help me with this task.

Trend = iMA(Symbol(), TrendTimeFrame, TrendPeriods, 0, MODE_LWMA, PRICE_CLOSE, 0);
// PrevTrend = iMACD(Symbol(), PERIOD_M1, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);

With this line of code from your LSMA_ MCAD_EMA mq4.


//+------------------------------------------------------------------------+
//| LSMA - Least Squares Moving Average function calculation |
//| LSMA_In_Color Indicator plots the end of the linear regression line |
//+------------------------------------------------------------------------+

double LSMA(int Rperiod, int shift)
{
int i;
double sum;
int length;
double lengthvar;
double tmp;
double wt;

length = Rperiod;

sum = 0;
for(i = length; i >= 1 ; i--)
{
lengthvar = length + 1;
lengthvar /= 3;
tmp = 0;
tmp = ( i - lengthvar)*Close[length-i+shift];
sum+=tmp;
}
wt = MathFloor(sum*6/(length*(length+1))/Point)*Point;

return(wt);
}




Or do I have to do something else to make this work?
Maybe this:

Trend = LSMA(int Rperiod, int shift);

?
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1284 (permalink)  
Old 09-20-2008, 10:04 PM
Junior Member
 
Join Date: Aug 2008
Posts: 7
takis76 is on a distinguished road
Smile Modifying the TakeProfit target in one order (in runtime)

Hi ,

I have one question.
When we have one open order we use the OrderModify function to trailing stop the order. In this case we modify the stoploss of the order.

Could is possible to modify the takeprofit target of one open order with OrderModify function?

OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Blue);

In my case I have one open order which has one sell position open and I have take profit for example when the EURUSD currency.

If we say my take profit target is 1.4010 but my currency goes near to take profit target but the order does not closes and then the trend is reversing and I loose my order by stop loss.

You will say , if you trailstop your order you will take the smaller profit.
But is it possible to change OrderTakeProfit variable to be smaller for example 1 pip so if my currency reaches the 1.4009 and never go to 1.4010 , how do I change take profit target in runtime and make it 1.4008 to take the profit. Not trailing stop.

Thank you very much.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1285 (permalink)  
Old 09-21-2008, 12:30 AM
Junior Member
 
Join Date: May 2008
Posts: 5
i2trader is on a distinguished road
Paging MR PIP

Not quite sure what you mean with that. Do i include the code of the LSMA
in { } directly behind that statement?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1286 (permalink)  
Old 09-21-2008, 01:48 AM
Junior Member
 
Join Date: Sep 2008
Posts: 2
koolzone is on a distinguished road
help me please!

can you help me to create simple EA:

the rules:
pair :GBPUSD
timeframe:15menit
take profit:15 pips
stoploss :15 pips
lots :0.1

open order: sellstop(-15) and buystop(+15) from price_open in current candle
EA will open order every 15 menit,when price_open=price_high=price_low

any body help me?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1287 (permalink)  
Old 09-21-2008, 01:56 AM
Senior Member
 
Join Date: Nov 2006
Posts: 215
luxinterior is on a distinguished road
That's quite a simple EA, why not try and write it yourself?

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1288 (permalink)  
Old 09-21-2008, 02:45 AM
Junior Member
 
Join Date: Sep 2008
Posts: 2
koolzone is on a distinguished road
Quote:
Originally Posted by luxinterior View Post
That's quite a simple EA, why not try and write it yourself?

Lux
thanks,
i will try it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1289 (permalink)  
Old 09-22-2008, 02:16 PM
Member
 
Join Date: Nov 2005
Posts: 47
G-Man is on a distinguished road
Determine The Oldest Orders

Hi guys,

I would appreciate it if someone can tell me how to identify the oldest orders within an EA to enable them to be closed.

Many thanks,

G-Man
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1290 (permalink)  
Old 09-22-2008, 11:08 PM
Senior Member
 
Join Date: Nov 2006
Posts: 215
luxinterior is on a distinguished road
Compare OrderOpenTime() of each order and close the oldest.

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
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:31 PM.



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