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
  #1201 (permalink)  
Old 08-24-2008, 11:28 AM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
:: hi! check the code inside this indicator... (for your opening time only, it's not an EA)
Quote:
Originally Posted by tcl View Post
please someone give me some advice how can I create an EA that make a pending order when the new bar start (daily TF) ?

thanks
__________________
..4.Nov.08.. IN10TION newsReader v09.85 Lite - the best news reader on your chart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1202 (permalink)  
Old 08-24-2008, 03:06 PM
Member
 
Join Date: Aug 2008
Posts: 32
fercan is on a distinguished road
Can anyone stop this from looping and looping?

Quote:
void BEM ()
{
int pips;
for (int k=0; k<OrdersTotal ();k++)
{
OrderSelect(k, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_BUY && OrderSymbol()== Symbol () && OrderMagicNumber()== Magic)
{
pips = (Bid - OrderOpenPrice())/Point;
if ((pips >= BE) && (OrderStopLoss() < OrderOpenPrice()))
{
OrderModify (OrderTicket (), OrderOpenPrice (),OrderOpenPrice ()+ 12*Point, OrderTakeProfit (), 0, LightBlue);
}
}
if(OrderType()==OP_SELL && OrderSymbol()== Symbol () && OrderMagicNumber()== Magic)
{
pips = (OrderOpenPrice() - Ask)/Point;
if ((pips >= BE) && (OrderStopLoss() > OrderOpenPrice()))
{
OrderModify (OrderTicket (), OrderOpenPrice (),OrderOpenPrice ()- 12*Point, OrderTakeProfit (), 0, Pink);
}
}
}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1203 (permalink)  
Old 08-24-2008, 03:45 PM
tcl's Avatar
tcl tcl is offline
Member
 
Join Date: Apr 2008
Posts: 83
tcl is on a distinguished road
Quote:
Originally Posted by IN10TION View Post
:: hi! check the code inside this indicator... (for your opening time only, it's not an EA)
thanks bro....

I'll take a look
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1204 (permalink)  
Old 08-24-2008, 03:59 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
:: if it's always looping you have to stop calling your function [BEM] every price tick coming in ... check your other code ...
Quote:
Originally Posted by fercan View Post
Can anyone stop this from looping and looping?
__________________
..4.Nov.08.. IN10TION newsReader v09.85 Lite - the best news reader on your chart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1205 (permalink)  
Old 08-24-2008, 04:01 PM
matrixebiz's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 1,174
matrixebiz is on a distinguished road
Quote:
Originally Posted by denis68 View Post
matrixebiz i have done that now i can't compile my ea when i added the following lines to my ea
double ac1 = iCustom(NULL, 0, "AcceleratorMod", 1, 1);
double ac2 = iCustom(NULL, 0, "AcceleratorMod", 2, 1);
double ac11 = iCustom(NULL, 0, "AcceleratorMod", 1, 2);
double ac22 = iCustom(NULL, 0, "AcceleratorMod", 2, 2);
bool acbuy = ac2==0 && ac11==0; // Red changes to Lime
bool acsell = ac1==0 && ac22==0; // Lime changes to Red

i get 12 errors: AC variable not defined :
and i would like to thank you for the help
Well you can't just add those lines without making the other necessary changes to your EA code.
Like your CloseBuy statement would change from;
if ((AC1 < AC2)) Order = SIGNAL_CLOSEBUY;

to;
if ((ac1==0 && ac22==0)) Order = SIGNAL_CLOSEBUY;

if your going to use these type of commands;
if ((ac1==0 && ac22==0)) Order = SIGNAL_CLOSEBUY;

then you wouldn't need these;
bool acbuy = ac2==0 && ac11==0; // Red changes to Lime
bool acsell = ac1==0 && ac22==0; // Lime changes to Red

I thought you new more code than you do.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1206 (permalink)  
Old 08-25-2008, 12:33 PM
Member
 
Join Date: Aug 2008
Posts: 32
fercan is on a distinguished road
Quote:
Originally Posted by IN10TION View Post
:: if it's always looping you have to stop calling your function [BEM] every price tick coming in ... check your other code ...
ok? so how do you do that? can you give me a code i can add before BEM?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1207 (permalink)  
Old 08-25-2008, 12:49 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
:: BEM deals with your indicator signals right? like your pips & BE values that are calculated somewhere else in your code... well, do this comparison somewhere else... not looping every time in between your orders. I don't see the rest of your code... that's up to you...

IN10TION
Quote:
Originally Posted by fercan View Post
ok? so how do you do that? can you give me a code i can add before BEM?
__________________
..4.Nov.08.. IN10TION newsReader v09.85 Lite - the best news reader on your chart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1208 (permalink)  
Old 08-25-2008, 01:03 PM
Member
 
Join Date: Jan 2008
Posts: 47
Pussy Galore is on a distinguished road
I'm still struggling with counting the stop loss bars from my earlier posts.

Looking at the original code, I've got a feeling that it might be flawed. It seems to be setting the stoploss at the bar low from "x" bars back rather than the lowest over the period of the "x" bars.

It reads:

Code:
SL=iLow(Symbol(),Period(),iLowest(Symbol(),Period( ),MODE_LOW,StopLossBars,0));
I don't understand why it is using both iLow and iLowest. Would I be correct in thinking that iLowest on its own is all that is needed?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1209 (permalink)  
Old 08-25-2008, 01:33 PM
Member
 
Join Date: Jan 2008
Posts: 47
Pussy Galore is on a distinguished road
I also have another problem with the code of my EA. I have a line which should close a position when certain criteria are met. One of the criteria is that the position is currently losing money.

This is the line:

Quote:
if ( (openPositions(OP_BUY)>0) && (OrderProfit( ) <= 0 ) && (macdnow < macd_signow) && (macdprevious > macd_sigprevious)) {closeLong();}
The EA works in that it certainly closes losing positions when the other criteria are met. For some reason though, the EA also closes winning positions too. I guess that I'm using the OrderProfit function incorrectly.

Could somebody help please?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1210 (permalink)  
Old 08-26-2008, 06:43 PM
Member
 
Join Date: May 2008
Posts: 54
fireslayer26 is on a distinguished road
Right now this indicator posts bar openings that are greater than or equal to the previous opening in Green and lower than in Red. My question is how would I change this code to make the openings that are EQUAL to the previous opening show up in YELLOW?

if( X01 >= X02 ) { color_X01 = Lime ; } else { color_X01 = Red ; }
if( X02 >= X03 ) { color_X02 = Lime ; } else { color_X02 = Red ; }
if( X03 >= X04 ) { color_X03 = Lime ; } else { color_X03 = Red ; }
if( X04 >= X05 ) { color_X04 = Lime ; } else { color_X04 = Red ; }
if( X05 >= X06 ) { color_X05 = Lime ; } else { color_X05 = Red ; }
if( X06 >= X07 ) { color_X06 = Lime ; } else { color_X06 = Red ; }
if( X07 >= X08 ) { color_X07 = Lime ; } else { color_X07 = Red ; }
if( X08 >= X09 ) { color_X08 = Lime ; } else { color_X08 = Red ; }
if( X09 >= X10 ) { color_X09 = Lime ; } else { color_X09 = Red ; }
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:12 PM.



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