查看: 1159|回复: 13
|
请问script 和 EA有什么分别?
[复制链接]
|
|
首先我要谢谢manchai。
请问script and EA 有什么分别?
请问以下是script还是EA?
//+------------------------------------------------------------------+
//| Close All 1_0.mq4 |
//| Copyright ?2007, Wolfe |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2007, Wolfe"
#property link ""
extern double Stop_Loss=-200; //If open order dollar amount is < Stop_Loss value Close All will be executrd
extern double Take_Profit=200;//If open order dollar amount is > Take_Profit value Close All will be executed
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
if ((AccountProfit() < Stop_Loss) || (AccountProfit() > Take_Profit))
{
while(OrdersTotal()>0)
{
OrderSelect(0,SELECT_BY_POS);
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),999,Purple);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),999,Purple);
if(OrderType()==OP_BUYLIMIT||OrderType()==OP_BUYSTOP||OrderType()==OP_SELLLIMIT||OrderType()==OP_SELLSTOP)
OrderDelete(OrderTicket());
}
}
//----
return(0);
}
//+------------------------------------------------------------------+ |
|
|
|
|
|
|
|
发表于 23-8-2009 07:08 PM
|
显示全部楼层
如果我没看错的话,这是ea。
int init()
{
//----
//----
return(0);
}
int deinit()
{
//----
//----
return(0);
}
mq4 的programming和一些普通的c programming 有些不同,但大致上syntax 还是一样的。
至于ea 和 script 有什么不同,我就不懂了。
![](static/image/smiley/default/3sweat.gif) |
|
|
|
|
|
|
|
![](static/image/common/ico_lz.png)
楼主 |
发表于 23-8-2009 11:00 PM
|
显示全部楼层
谢谢您的意见,请问 if script 的code 放在 EA 里面或者 EA的 CODE 放在script里面,这还可以用吗? |
|
|
|
|
|
|
|
发表于 23-8-2009 11:46 PM
|
显示全部楼层
|
|
|
|
|
|
|
![](static/image/common/ico_lz.png)
楼主 |
发表于 25-8-2009 12:52 PM
|
显示全部楼层
回复 4# mancai 的帖子
谢谢您的资料。
OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),999,Purple);
请问上诉的 999,purple 是什么意思? |
|
|
|
|
|
|
|
发表于 25-8-2009 02:03 PM
|
显示全部楼层
|
|
|
|
|
|
|
![](static/image/common/ico_lz.png)
楼主 |
发表于 25-8-2009 04:44 PM
|
显示全部楼层
回复 6# mancai 的帖子
谢谢您的资料。
bool OrderClose( int ticket, double lots, double price, int slippage, color Color=CLR_NONE)
Closes opened order. If the function succeeds, the return value is true. If the function fails, the return value is false. To get the detailed error information, call GetLastError().
Parameters:
ticket - Unique number of the order ticket.
lots - Number of lots.
price - Preferred closing price.
slippage - Value of the maximum price slippage in points.
Color - Color of the closing arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.
Sample:
if(iRSI(NULL,0,14,PRICE_CLOSE,0)>75)
{
OrderClose(order_id,1,Ask,3,Red);
return(0);
}
我还是不明白这 slippage - Value of the maximum price slippage in points.
请各位指教 |
|
|
|
|
|
|
|
发表于 25-8-2009 06:41 PM
|
显示全部楼层
slippage是最大价格滑动值
当价格移动很快时,比如你要place order在1.5000
但你下单时价格飙到1.5005,5 pips,如果slippage 大过5就ok
slippage就是你容许的最大价格滑动值 |
|
|
|
|
|
|
|
![](static/image/common/ico_lz.png)
楼主 |
发表于 25-8-2009 07:32 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 26-8-2009 04:40 AM
|
显示全部楼层
我的 script ,一时能够用,一时却毫无动静
到底是因为什么? |
|
|
|
|
|
|
|
发表于 26-8-2009 09:03 AM
|
显示全部楼层
原帖由 eric^zai 于 26-8-2009 04:40 AM 发表 ![](http://cforum2.cari.com.my/images/common/back.gif)
我的 script ,一时能够用,一时却毫无动静
到底是因为什么?
什么script? |
|
|
|
|
|
|
|
发表于 26-8-2009 01:10 PM
|
显示全部楼层
几乎我下载的 script 都是一样
有 Pending Order , Buy/Sell , TS |
|
|
|
|
|
|
|
发表于 26-8-2009 01:49 PM
|
显示全部楼层
原帖由 eric^zai 于 26-8-2009 01:10 PM 发表 ![](http://cforum2.cari.com.my/images/common/back.gif)
几乎我下载的 script 都是一样
有 Pending Order , Buy/Sell , TS
EA还是script? |
|
|
|
|
|
|
|
发表于 26-8-2009 01:52 PM
|
显示全部楼层
原帖由 mancai 于 26-8-2009 01:49 PM 发表 ![](http://cforum3.cari.com.my/images/common/back.gif)
EA还是script?
都是 script |
|
|
|
|
|
|
| |
本周最热论坛帖子
|