|
|||||||
| 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 |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
MT4 file functions
hello, my Indicator uses the following code to record every trade signal to a text file. by default, the latest signal is the last record at the bottom of the file. what I want to do is to reverse this order. that is, I'd like my latest signal to come on top. does anybody know how to do this?
void Trade_Log(string type,string price,string sigBar) { //---- int handle = 0; string log = ""; //---- log = type+"@"+price+" @ "+sigBar+" bars"; handle = FileOpen("lastSignal_.dat",FILE_BIN|FILE_READ|FILE _WRITE); if(handle>0){ FileSeek(handle,0,SEEK_END); FileWrite(handle,log); FileClose(handle); handle = 0; } //---- } |
|
|||
|
Help needed - How to code MQL 50% Trailing Stop?
Hi,
Thanks in advance. Does anyone know the code MQL MT4 to incorporate a 50% Trailing Stop after profit has cross "x" pips? Thanks thanks thanks. ed Last edited by eooojj : 12-02-2006 at 02:26 PM. |
|
|||
|
regarding OrderTicket() function
I want my EA to check and make sure that it can only have one pending order in the pool at any one time, so I wrote the following code to do that:
int CheckOrders() { //---- int i,orders; int tickets[]; //---- int ticket = 0; int total = OrdersTotal(); //---- for(i=total;i>=0;i--) tickets[i] = 0; //---- for(i=total;i>=0;i--){ if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){ if(OrderMagicNumber()==magic_base && OrderType()>1){ orders++; tickets[i] = OrderTicket(); Print("tickets = ",tickets[i]); } } } Print("total = ",total," orders = ",orders); while(orders>1){ for(i=total;i>=0;i--){ if(ticket==0 && tickets[i]>0) ticket = tickets[i]; if(ticket>tickets[i]) ticket = tickets[i]; } if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES )){ OrderDelete(ticket); } orders--; } Print("ticket = ",ticket); //---- return(0); } It displays the number of pending orders in the pool by the same EA correctly, but it won't delete the unwanted pending orders, because it always shows that tickets[i] = 0. and because of this, the OrderDelete(ticket) won't work. Could sb please tell me why this would happen? |
|
|||
|
Noobie need help
hi guys, could some one teach me how to stop EA from trading at news time?
sleep command thing, and how to add in to an existing EA without need to rewrite the whole thing....because i am dumb at reading code an writing code (using metatrader expert advisor builder) sample of sleep command code in 1 line or only the related line only, dont do the whole EA/indicator and ask me to read...i don't know how to =/ sorry.... i tried many times try to read an EA, even using the metatrader dictionary thing, but alot of the code i saw in an EA isnt in the dictionary....and the dictionary isnt very specify...well atleast for me.... dummy proof please >< |
|
|||
|
Resources for MQL4 writing ?
Any videos I can buy, or a complete book on the subject. I have various tutorials, but none very helpfull. Sure would be nice to look at a real EA with notes next to each line indicating exactly what the line means.
Also helpfull if one could get a tutorial on editing an EA, I think that would be the best way to learn, editing an EA to fit your style. Thanks for any info... |
|
|||
|
Quote:
- mql4 development course; - Templates to create EAs and Indicators; - Codersguru lessons in his website; - Trading the MetaTrader; Codersguru lessons. - mql4 Metatrader development course; - All Codersguru lessons in one ebook; - mql4 starting and continuing. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Learning Cycles For New Traders | Dan7974 | General Discussion | 350 | 01-18-2008 06:04 PM |
| Learning to code for autotrading | GoatT | Metatrader Programming | 8 | 01-10-2007 08:55 PM |
| Self learning expert | mrtools | Expert Advisors - Metatrader 4 | 32 | 10-22-2006 05:29 PM |