对EA的密码保护

 

嗨,伙计们

为EA设置密码保护 的代码是什么?

是否有可能让我们的EA在银行间外汇服务器上工作?

希望能得到任何帮助

再见

薛伟达

 
shwetha:
嗨,伙计们

对EA进行密码保护的代码是什么?

是否有可能让我们的EA在银行间外汇服务器上工作?

希望能得到任何帮助

再见

薛伟达

嗨,shwetha。

非常简单,朋友

extern string password = "000000";

....

int start()

{

if (password != 123456) //change the 123456 to the password you will give to the user!

{

Alert ("Wrong password! Do you want to cheat my system which I spent my life developing!");

return (0);

....

}

然后编译EA并享受其乐趣

 
Mohammed:
嗨,shwetha。

非常简单的朋友!

extern string password = "000000";

....

int start()

{

if (password != 123456) //change the 123456 to the password you will give to the user!

{

Alert ("Wrong password! Do you want to cheat my system which I spent my life developing!");

return (0);

....

}
然后编译EA并享受

顺便问一下,你为什么要保护你的EA?我们不是在这里分享知识吗?

 

显示错误

嗨,Mohammed

谢谢你的回答。但当我编译时,显示了以下错误

'{' - 不允许在全局范围内表达。

'\end_of_program' - 预计将出现括号'}'。

等待您的回复

再见

薛伟达

 
shwetha:
嗨,Mohammed

谢谢你的回答。但当我编译时,显示出以下错误

'{' - 不允许在全局范围内表达。

'\end_of_program' - 预计将出现括号'}'。

等待您的回复

再见

薛伟达

shwetha,

这只是一个关于代码如何写的想法。

那么,代码应该是这样的(应用于Coders Guru的教育性EA "My First EA"。

//+------------------------------------------------------------------+

//| My_First_EA.mq4 |

//| Coders Guru |

//| https://www.forex-tsd.com |

//+------------------------------------------------------------------+

#property copyright "Coders Guru"

#property link "https://www.forex-tsd.com"

//---- input parameters

extern double TakeProfit=250.0;

extern double Lots=0.1;

extern double TrailingStop=35.0;

extern string password = "000000";

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

int Crossed (double line1 , double line2)

{

static int last_direction = 0;

static int current_dirction = 0;

if(line1>line2)current_dirction = 1; //up

if(line1<line2)current_dirction = 2; //down

if(current_dirction != last_direction) //changed

{

last_direction = current_dirction;

return (last_direction);

}

else

{

return (0);

}

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

//----

if(StringFind(password, "123456", 0) == -1) //change the 123456 to the password you will give to the user!

{

Alert ("Wrong password! Do you want to cheat my system which I spent my life developing!");

return (0);

}

int cnt, ticket, total;

double shortEma, longEma;

if(Bars<100)

{

Print("bars less than 100");

return(0);

}

if(TakeProfit<10)

{

Print("TakeProfit less than 10");

return(0); // check TakeProfit

}

shortEma = iMA(NULL,0,8,0,MODE_EMA,PRICE_CLOSE,0);

longEma = iMA(NULL,0,13,0,MODE_EMA,PRICE_CLOSE,0);

int isCrossed = Crossed (shortEma,longEma);

total = OrdersTotal();

if(total < 1)

{

if(isCrossed == 1)

{

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,"My EA",12345,0,Green);

if(ticket>0)

{

if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());

}

else Print("Error opening BUY order : ",GetLastError());

return(0);

}

if(isCrossed == 2)

{

ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point,"My EA",12345,0,Red);

if(ticket>0)

{

if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());

}

else Print("Error opening SELL order : ",GetLastError());

return(0);

}

return(0);

}

for(cnt=0;cnt<total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())

{

if(OrderType()==OP_BUY) // long position is opened

{

// should it be closed?

if(isCrossed == 2)

{

OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position

return(0); // exit

}

// check for trailing stop

if(TrailingStop>0)

{

if(Bid-OrderOpenPrice()>Point*TrailingStop)

{

if(OrderStopLoss()<Bid-Point*TrailingStop)

{

OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);

return(0);

}

}

}

}

else // go to short position

{

// should it be closed?

if(isCrossed == 1)

{

OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position

return(0); // exit

}

// check for trailing stop

if(TrailingStop>0)

{

if((OrderOpenPrice()-Ask)>(Point*TrailingStop))

{

if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))

{

OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);

return(0);

}

}

}

}

}

}

return(0);

}

//+------------------------------------------------------------------+
 

为什么?

你还没有回复我 ;你想保护EA的什么?我们在这里不是为了分享知识和互相帮助的吗?(记得我用Coders Guru的免费EA向你展示我的免费代码)?

 

也可以使用Metatrader版本的试用EA。

EA只在MetaTrader构建版本190上运行!

如果MT Build !=190,则删除EA !

--

 

或者,如果你是一个IB,为新账户提供一个系统,你可以将该系统与你的IB账户绑定。新的交易员将能够在他的账户上使用该系统,但只能在你这里使用。保护你不被他用在不会给你带来任何佣金的账户上。

我也想知道为什么要使用PassWord?这将使如何保护代码变得不同。

牛郎织女

 

我的版本是191

我的meta trader版本是4 build191

 

那么,有数百种方法可以保护你的EA。

1- 你可以使用我提交的代码(硬编码的密码)。

2- 你可以做一个算法来收集一些东西并与密码进行比较。(例如:账户保证金 x购买日期/100)。

3- 你可以创建一个dll并与EA一起发送,dll将处理密码(它可以连接到你的网站并获得密码)。

4- 你可以将EA与用户的账户号码绑定。你通过电子邮件要求他给你帐号,然后你把它放在EA中,并进行编译,然后把编译好的版本发给用户。

5- 你可以让EA只在指定的MT版本中工作。

6- 您可以限制EA的运行次数。

7- 您可以限制使用该EA的天数。

8- 您可以免费分享该EA,并要求用户如果喜欢它就捐赠给您。建议

 

Mohammed:
你还没有回复我 ;你想保护EA的什么?我们在这里不是为了分享知识和互相帮助的吗?(记得我使用了Coders Guru的免费EA来向你展示我的免费代码)?

嗨,Mohammed

我需要密码保护,以防我想在经纪人的服务器上加载我的EA。不是说我不想在论坛上分享。

拜拜

谢谢

薛伟达