Forex



Go Back   Forex Trading > Programming > MetaTrader
Forex Forum Register More recent Blogs 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
  #31 (permalink)  
Old 03-02-2006, 11:36 PM
Junior Member
 
Join Date: Nov 2005
Posts: 5
warpio is on a distinguished road
Request: EA code to double up lot size after a losing trade.

I want to know if there's any way to tell an EA to increase the lot size if the last trade closed in loss (martingale system), and use the normal lot size if the last trade closed in profit. It needs to be able to use micro lots. Is there any way to do this?
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
  #32 (permalink)  
Old 03-03-2006, 10:00 PM
stu stu is offline
Junior Member
 
Join Date: Feb 2006
Posts: 20
stu is on a distinguished road
Question Have code, need help making EA

I have a portion of code for a Moving Stop, but have no programming experience to make an EA out of it. Will somebody with EA creation ability kindly produce an EA with the code below?!?

Code:
total=OrdersTotal(); 
   if(total>0){ 
      for(cnt=0;cnt<total;cnt++){ 
         OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); 
         if(OrderType()==OP_BUY && OrderSymbol()==Symbol()){ 
            if(Bid-OrderOpenPrice()>=Point*15 &&  Bid-OrderOpenPrice()<Point*20 && OrderStopLoss()< OrderOpenPrice()-5*Point){ 
               OrderModify(OrderTicket(),OrderOpenPrice()-Point*5,OrderTakeProfit(),Blue); 
            } 
            if(Bid-OrderOpenPrice()>=Point*20 && OrderStopLoss()< OrderOpenPrice()){ 
               OrderModify(OrderTicket(),OrderOpenPrice(),OrderTakeProfit(),Blue); 
            } 
         } 
      } 
   }
The EA will move the Stop to -5 after moving 15 pips favorably, and move Stop to BreakEven after moving 20 pips favorably.
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
  #33 (permalink)  
Old 03-03-2006, 11:42 PM
Mohammed's Avatar
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Arrow

Quote:
Originally Posted by stu
I have a portion of code for a Moving Stop, but have no programming experience to make an EA out of it. Will somebody with EA creation ability kindly produce an EA with the code below?!?

Code:
total=OrdersTotal(); 
   if(total>0){ 
      for(cnt=0;cnt<total;cnt++){ 
         OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); 
         if(OrderType()==OP_BUY && OrderSymbol()==Symbol()){ 
            if(Bid-OrderOpenPrice()>=Point*15 &&  Bid-OrderOpenPrice()<Point*20 && OrderStopLoss()< OrderOpenPrice()-5*Point){ 
               OrderModify(OrderTicket(),OrderOpenPrice()-Point*5,OrderTakeProfit(),Blue); 
            } 
            if(Bid-OrderOpenPrice()>=Point*20 && OrderStopLoss()< OrderOpenPrice()){ 
               OrderModify(OrderTicket(),OrderOpenPrice(),OrderTakeProfit(),Blue); 
            } 
         } 
      } 
   }
The EA will move the Stop to -5 after moving 15 pips favorably, and move Stop to BreakEven after moving 20 pips favorably.
stu,

Do you want to apply this technique to any EA? Or you have entry points for this EA?

I think your technique is very good one!
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
  #34 (permalink)  
Old 03-04-2006, 12:18 AM
stu stu is offline
Junior Member
 
Join Date: Feb 2006
Posts: 20
stu is on a distinguished road
I will enter my system manually, I do not trust EA entry yet. I want to use EA ONLY for exit now. I feel EXIT strategy is equally (if not more) important than entry strategy. I do not like Trailing Stops, I have had much more success with STEPPED MOVING STOPS. I would love to have EA to do this for me because I have time to place trade but no time to monitor for exit. I like to backtest VISUALLY,, which is very slow but I have very specific entry criteria so it works well for me. I am currently reading Codergurus AWESOME lesson for BEGINNERS to programming MQ4: http://www.metatrader.info/node/59

Codersguru, if you are reading this thread, let me tell you man: You are a genius!

I still need help making this EA.
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
  #35 (permalink)  
Old 03-06-2006, 11:15 PM
RickD's Avatar
Member
 
Join Date: Jan 2006
Location: Eastern Europe
Posts: 54
RickD is on a distinguished road
For example:
Code:
  double lot = Lots;
  
  int ticket = GetLastOrder(Symbol(), OP_BUY, MODE_HISTORY);
  if (ticket >= 0) {  
    OrderSelect(ticket, SELECT_BY_TICKET, MODE_HISTORY);
    
    if (OrderProfit() > 0) lot = 2*OrderLots();
  }

int GetLastOrder(string symbol, int type, int mode) {
  int cnt = -1;
  if (mode == MODE_TRADES) cnt = OrdersTotal(); else 
  if (mode == MODE_HISTORY) cnt = HistoryTotal(); else
  return(-1);
  
  int ticket = -1;
  datetime dt = 0;
  for (int i=0; i < cnt; i++) {
    if (!OrderSelect(i, SELECT_BY_POS, mode)) continue;

    if (OrderSymbol() != symbol) continue;
    if (OrderMagicNumber() != Magic) continue;
    
    if (OrderCloseTime() > dt && OrderType() == type) {
      dt = OrderCloseTime();
      ticket = OrderTicket();
    }
  }
  
  return(ticket);
}
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
  #36 (permalink)  
Old 03-10-2006, 05:03 AM
SPACECHIMP's Avatar
Member
 
Join Date: Feb 2006
Location: West Michigan, USA.
Posts: 86
SPACECHIMP is on a distinguished road
Traders secret Code?

anyone hear any details on Traders Secret Code by Mark Mcrae?
I've heard some good reviews, but maybe it's too new to tell if it's REALLY that good.



www.traderssecretcode.com
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
  #37 (permalink)  
Old 03-10-2006, 05:14 AM
niva's Avatar
Senior Member
 
Join Date: Mar 2006
Posts: 101
niva is on a distinguished road
I see no reason to him still making money on selling books.
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
  #38 (permalink)  
Old 03-10-2006, 10:02 AM
Senior Member
 
Join Date: Jan 2006
Location: 3rd rock from the sun
Posts: 142
fred is on a distinguished road
http://www.traderssecretcode.com/

I've seen a few of his free videos he sends out as I'm on his mailing list. Nearly all of these strategies include Moving averages, basic Fibonacci retracements etc.
I don't have access to his video site though, so don't know if they are any better. I deleted the free ones I got as they were useless hindsight cherry picked trades, but if I had access to his video site I would share it.
Maybe someone here has access?
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
  #39 (permalink)  
Old 03-11-2006, 01:34 PM
Junior Member
 
Join Date: Feb 2006
Posts: 9
divergence_trader is on a distinguished road
i'm looking for code to make my EA trade at half volume if it trades the same direction in a pair twice in a row, i.e

if i enter GBPUSD at full volume long at 1.7500, and the next signal I see is also a GBPUSD long say at 1.7530, the second trade should be half volume, as it is rejoining a move which has already been going for a while, so the risk should be lowered.

so basically i need my EA to access the record of the last closed trade on the current pair and get it's open price and whether it was a short or long position.

could the above code be modified to do something like that? i've tried to do it myself but it's all a bit advanced for me

thanks
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
  #40 (permalink)  
Old 03-12-2006, 10:25 PM
Junior Member
 
Join Date: Mar 2006
Posts: 1
sitearsiv is on a distinguished road
thanks you.
__________________
web hosting provider
uewzs
forex
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, dll, eli hayun, Eur_harvester.ex4, expert adviser, expert advisor, forex, higher high, how to code, indicator, I_XO_A_H, kehedge, mechanical trading, metatrader command line, mt4, MT4-LevelStop-Reverse, OrderReliable.mqh, programming, rectangle tool, 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 05:22 PM


All times are GMT. The time now is 01:31 AM.



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