Follow us on
Forgot your password?
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
  #901 (permalink)  
Old 03-05-2010, 12:20 AM
serulink's Avatar
Member
 
Join Date: Jul 2007
Location: www.serulink.com
Posts: 49
serulink is on a distinguished road
use moving average
rule :
buy if price < MA
sell if price > MA
MA periode ... 12 or 16

__________________
Free Forex Prediction - www.serulink.com
My Performance - www.mt4i.com/users/battosai
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!Share this post on Twitter!
Reply With Quote
  #902 (permalink)  
Old 03-09-2010, 01:42 PM
kra kra is offline
Junior Member
 
Join Date: Jan 2006
Posts: 2
kra is on a distinguished road
Question SL management code help

Hi guys,

I have written a piece of code to manage my EA open orders but part of it is not executing (when in loss part). Can someone help?

Here is the code (sorry, it's not nice to read it here but I don't know other way to post it):


//stop loss management
for(i=0;i<Total;i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // check for opened position
OrderSymbol()==Symbol()) // check for symbol
{
if (OrderLots() == Lots) //Prevent closing multiple times
{
if(OrderType()==OP_BUY) // long position is opened
{
// Move Stop
if (Bid - OrderOpenPrice () >= TakeProfitPartial * Point)
//if(true)
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOp enPrice() + 30 * Point,OrderTakeProfit()*Point,0,Purple);//
OrderClose (OrderTicket(), LotsPartial, Bid, 30 /*Slippage*/, Yellow);


////// to close part if in loss and move take profit to b/e --NOT WORKING

if(Bid - OrderOpenPrice () <= - (TakeProfitPartial * Point))
{
OrderModify(OrderTicket(),OrderOpenPrice(),StopLos sLevel,OrderOpenPrice() +30*Point,0,Purple);//
OrderClose (OrderTicket(), LotsPartial, Bid, 30 /*Slippage*/, Yellow);
return(0);
}
}
}
else // go to short position
{
// Move Stop
if (OrderOpenPrice() - Ask >= TakeProfitPartial * Point)
//if(true)
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOp enPrice() - 30 * Point,OrderTakeProfit()*Point,0,Purple);/////
OrderClose (OrderTicket(), LotsPartial, Ask, 30 /*Slippage*/, Yellow);

////// to close part if in loss and move take profit to b/e --NOT WORKING
if(OrderOpenPrice() - Ask <= - (TakeProfitPartial * Point))
{
OrderModify(OrderTicket(),OrderOpenPrice(),StopLos sLevel,OrderOpenPrice()-30 *Point,0,Purple);/////
OrderClose (OrderTicket(), LotsPartial, Ask, 30 /*Slippage*/, Yellow);
return(0);

}

}
}
}
}
}
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!Share this post on Twitter!
Reply With Quote
  #903 (permalink)  
Old 03-09-2010, 10:07 PM
kra kra is offline
Junior Member
 
Join Date: Jan 2006
Posts: 2
kra is on a distinguished road
SL management code help

It's ok. I fixed it.

Cheers!
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!Share this post on Twitter!
Reply With Quote
  #904 (permalink)  
Old 03-12-2010, 02:53 PM
Junior Member
 
Join Date: Aug 2009
Posts: 3
jizhong68 is on a distinguished road
Help! How to sort a two dimension array

I am using a two dimension array, say, ZigZag[2][100]. and I want to sort by the first dimension. I use the following function:

ArraySort(ZigZag,WHOLE_ARRAY,0,MODE_DESCEND);

but it seem neither sort by first dimention, nor by second dimension. is there anybody here can help me?

Thanks a lot
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!Share this post on Twitter!
Reply With Quote
  #905 (permalink)  
Old 03-14-2010, 08:35 AM
Junior Member
 
Join Date: Mar 2009
Posts: 2
masheco is on a distinguished road
EA draws MA

How can I draw MA line from my EA?

Thank you in advance
Masheco
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!Share this post on Twitter!
Reply With Quote
  #906 (permalink)  
Old 03-15-2010, 12:03 AM
Junior Member
 
Join Date: Jul 2009
Posts: 4
coderMike is on a distinguished road
If you want to draw a moving average line with your EA, you need to obtain the moving average value from the indicator function, then paint it onto the chart using the trend line option with the ObjectCreate() function.

Here is an example to draw the moving average trend line.
This code is executed at the close of each bar.

static double MA;
static double previousMA;


previousMA = MA;
MA=iMA(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,0);

int time2=Time[0];
ObjectDelete("Tr1"+time2);
ObjectCreate("Tr1"+time2, OBJ_TREND,0,Time[0],MA,
Time[1],previousMA);
ObjectSet("Tr1"+time2, OBJPROP_COLOR,SteelBlue);
ObjectSet("Tr1"+time2, OBJPROP_RAY,false);
ObjectSet("Tr1"+time2, OBJPROP_STYLE,STYLE_SOLID);

coderMike
mql4coder@gmail.com
~providing quality EA programming services~
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!Share this post on Twitter!
Reply With Quote
  #907 (permalink)  
Old 03-15-2010, 05:34 PM
Junior Member
 
Join Date: Mar 2010
Posts: 2
mausgambler is on a distinguished road
No sound by close Order

Hello !
How can i adjust in metatrader, that he play a sound if a order was taken from the market (because SL or TP or whatever)
I can not found the settings.
Also give it a possibility to loads indicatoren automatic if i open a Chart-Window
All time i close a Chart, and reopen, all indicater and settings(Candlesticks,...) are lost, and i must import again

Thanks for Help
Wolfgang
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!Share this post on Twitter!
Reply With Quote
  #908 (permalink)  
Old 03-15-2010, 07:15 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 1,000
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Lightbulb templates

Hello,

1- There's no sounds for SL/TP events in MetaTrader.
2- You can save all the indicators and the objects of a chart to a template then reload it when you need:
Right click the chart you want to save it as a template.
Choose Templates -> Save Template ..
Give it a name and save it.

To Load the template you saved:
Right click the chart you want to load the template on.
Choose Templates -> Load Template ..
Choose the template.

Quote:
Originally Posted by mausgambler View Post
Hello !
How can i adjust in metatrader, that he play a sound if a order was taken from the market (because SL or TP or whatever)
I can not found the settings.
Also give it a possibility to loads indicatoren automatic if i open a Chart-Window
All time i close a Chart, and reopen, all indicater and settings(Candlesticks,...) are lost, and i must import again

Thanks for Help
Wolfgang
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
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!Share this post on Twitter!
Reply With Quote
  #909 (permalink)  
Old 03-17-2010, 01:09 AM
Junior Member
 
Join Date: Feb 2010
Posts: 1
Forex2k11 is on a distinguished road
Reversing Trades MQL

Hey,
I'm wondering if there is any simple way to reverse the trades an EA makes. I know a decent amount of MQL, but I'm not sure if there's an easier way to simply turn all buys into sells and sells into buys, reversing the logic of the trades other than editing every piece of logic. Is there any easier way of doing this?

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!Share this post on Twitter!
Reply With Quote
  #910 (permalink)  
Old 03-17-2010, 02:46 AM
Senior Member
 
Join Date: Feb 2006
Posts: 108
odirlei is on a distinguished road
Quote:
Originally Posted by Forex2k11 View Post
Hey,
I'm wondering if there is any simple way to reverse the trades an EA makes. I know a decent amount of MQL, but I'm not sure if there's an easier way to simply turn all buys into sells and sells into buys, reversing the logic of the trades other than editing every piece of logic. Is there any easier way of doing this?

Thanks
Try this one:

Forex Tester Software - Professional Forex Training. Teach yourself forex trading.

It copy trades from one MT4 to another and there is a setting that reverse trades. I never use it, so I don´t know if work fine, but it can be a option.
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!Share this post on Twitter!
Reply With Quote
Reply

Bookmarks

Tags
automated close order, close, eas, forex, istochastic, learn mql4, learn mql4 video, learning mql4, mini std lotsize risk, mql4 ima, mql4 learning, mql4 video, OrderCloseBy, profit, re-initialise indicator, reach, secure profit function, stoch, T101_v1.11_orest_IBFXm.mq4


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
Self learning expert mrtools Expert Advisors - Metatrader 4 38 02-11-2010 02:43 AM
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


All times are GMT. The time now is 07:49 PM.



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