Go Back   Forex-TSD > Programming > MetaTrader Programming
Forex Forum Register More recent Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #221 (permalink)  
Old 03-19-2007, 12:21 AM
islandrock's Avatar
Member
 
Join Date: Jan 2007
Posts: 87
islandrock is on a distinguished road
Exclamation ??

that code does not make each trade my EA opens expire 12 hours from the time it opens...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #222 (permalink)  
Old 03-19-2007, 11:07 AM
Wackena's Avatar
Senior Member
 
Join Date: May 2006
Posts: 216
Wackena is on a distinguished road
Quote:
Originally Posted by islandrock
that code does not make each trade my EA opens expire 12 hours from the time it opens...
Order expiration time works on pending orders only. If OrderSend() is OP_BUY or OP_SELL, you need to time your order within the code. Here is one simple example.

Code:
int OrderTime;

OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,Ask+TakeProfit*Point,"timetest",16384,0,Green)
OrderTime=TimeCurrent();


int total = OrdersTotal();
for(int cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if((OrderType() <= OP_SELL) && (OrderSymbol() == Symbol()) )
{
if(OrderType()==OP_BUY && TimeCurrent()-OrderTime>(12*60)*60)
{
OrderClose(OrderTicket(),LotsOptimized(),Bid,3,Violet);
}
}
}
Wackena

Last edited by Wackena; 03-19-2007 at 11:10 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #223 (permalink)  
Old 03-21-2007, 02:24 PM
islandrock's Avatar
Member
 
Join Date: Jan 2007
Posts: 87
islandrock is on a distinguished road
code not function right

I used this to email the status of my account every hour to me. however after i compile and loaded it. it sent that email perfectly the next hour at minute# 59 as it's supposed to then it never sent another one again. what i'm i doing wrong? it looks perfect ?
i dont need it at min #59 i just need it every hour!!




bool mail;
int start()


{
if (Minute()>=59 && !mail){
SendMail("Account Status", "Account Balance is="+DoubleToStr(AccountBalance(),2)+"_Account Equity is="+DoubleToStr(AccountEquity(),2)+
"_Account Profit is="+DoubleToStr(AccountProfit(),2)+"_Account Margin is="+DoubleToStr(AccountMargin(),2)+
"_Account Free Margin is="+DoubleToStr(AccountFreeMargin(),2));
mail=true;
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #224 (permalink)  
Old 03-21-2007, 02:32 PM
jlpi's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 336
jlpi is an unknown quantity at this point
maybe you just need to put mail = false at some point or just remove this test on mail variable because of course the current code will send only 1 mail.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #225 (permalink)  
Old 03-21-2007, 02:41 PM
islandrock's Avatar
Member
 
Join Date: Jan 2007
Posts: 87
islandrock is on a distinguished road
what test on mail variable ?.. i do not under stand please explain..
how about right after mail=true i put

if (minute()<=58 && !mail)
mail= false;

think that might work?...
i think it's coded wrong
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #226 (permalink)  
Old 03-21-2007, 03:03 PM
jlpi's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 336
jlpi is an unknown quantity at this point
I think you can put


if (minute()<=58 && mail) // be careful not !mail but mail
mail= false;

and that should be but outside your first if , so not after mail = true; but after }

There are probably better ways to code that but that should work
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #227 (permalink)  
Old 03-21-2007, 03:16 PM
islandrock's Avatar
Member
 
Join Date: Jan 2007
Posts: 87
islandrock is on a distinguished road
Smile going to try

thanks will give it a shot...will let you know in two hours
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #228 (permalink)  
Old 03-21-2007, 09:14 PM
islandrock's Avatar
Member
 
Join Date: Jan 2007
Posts: 87
islandrock is on a distinguished road
great it works.... or at least it looks like it does
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #229 (permalink)  
Old 03-25-2007, 04:47 PM
islandrock's Avatar
Member
 
Join Date: Jan 2007
Posts: 87
islandrock is on a distinguished road
Question ?? need help with this part of code

can anyone tell me how to write this correctly? im trying to single out the open buy and sell trades individually...


i.e. : if open bid > 2.
if open ask >2
I got the rest I just cant code that part right
i know it's simple but i'm pulling out my hair.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #230 (permalink)  
Old 03-26-2007, 12:21 PM
islandrock's Avatar
Member
 
Join Date: Jan 2007
Posts: 87
islandrock is on a distinguished road
anybody?

anybody? wow maybe this was a bad question
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
#include, candle time, CHinGsMAroonCLK, code, coders guru, conditionally, crossover, dll, eli hayun, Eur_harvester.ex4, expert adviser, expert advisor, forex, Gann Hilo, higher high, how to code, indicator, I_XO_A_H, kehedge, mechanical trading, metatrader command line, mql4, mt4, MT4-LevelStop-Reverse, OrderReliable.mqh, programming, rectangle tool, strings, time range high low, trading, volty channel stop


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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


All times are GMT. The time now is 03:40 PM.



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