编码帮助 - 页 477 1...470471472473474475476477478479480481482483484...786 新评论 yinyang88 2015.05.25 09:28 #4761 你好,编程高手。 我试图编写一个PPO_alt指标,即图片a和b中的图1,但它在实时模式下不能正确绘制。 所以我尝试修改原始的PPO(图2),但它仍然不正确。 请看一下,你能不能解决这两个问题。 谢谢。 PS. 如果你不清楚,请提出更多问题。 附加的文件: ppo_mod.rar 80 kb myname 2015.05.26 04:58 #4762 download38: 你好,编码员大师。我试图编写一个PPO_alt指标,即图片a和b中的图1,但它在实时模式下不能正确绘制。 所以我尝试修改原始的PPO(图2),但它仍然不正确。 请看一下,你能不能解决这两个问题。 谢谢。 PS. 如果你不清楚,请多提问题。 为什么你在两个循环中做完全相同的事情? vegadigitalco 2015.05.26 05:17 #4763 你好,Mladen 需要帮助 无法获得实时报价,请帮助 //+------------------------------------------------------------------+ //|专家初始化功能 //+------------------------------------------------------------------+ #property indicator_chart_window double ExtMapBuffer1[]; extern int RSI_periode = 14; extern int RSI_level = 50; 外部颜色 BuyColor = clrLime; 外部颜色 SellColor = clrRed; 外来的int horizontal = 20; External int vertical = 50; 外置 int shift = 1; 外置双倍百分比 = 0.25; extern string fontmode = "Arial"; Extern int fontsize = 10; 外部颜色 fontcolor = clrSkyBlue; Extern int columnspacing = 100; int init() { //---- SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); //---- return(0); } //+------------------------------------------------------------------+ //|专家去初始化功能| //+------------------------------------------------------------------+ int deinit() { //---- ObjectsDeleteAll()。 ObjectDelete("INFO")。 //---- return(0); } //+------------------------------------------------------------------+ //|专家启动功能| //+------------------------------------------------------------------+ int start() { //---- string symlist2[] = {"NIFTY", "B.NIFTY", "XAUUSD", "GOLD" }; 字符串符号。 string info2[] = {MODE_HIGH,MODE_LOW,MODE_BID,MODE_ASK}; 字符串 infolabel。 string timeText[] = {"DayHigh", "DayLow", "Bid", "Ask" }; string font = "Terminal"; int counted_bars=IndicatorCounted(); int symlimit = ArraySize(symlist2); int timelimit = ArraySize(info2); for(int i=0;i<symlimit;i++) { 符号 = symlist2; 显示("symlabel" + symbol + i, horizontal,vertical)。 ObjectSetText("symlabel" + symbol + i, "SYMBOL", fontsize, font, Pink); Display("sym" + symbol + i, horizontal,vertical +((i+1)*18)); ObjectSetText("sym" + symbol + i, "" + symbol + "", fontsize, font, Yellow)。 for(int j=0;j<timelimit;j++) { infolabel = info2[j]; Display("infolabel" + j, horizontal+((j+1)*100), vertical); ObjectSetText("infolabel" + j, timeText[j], fontsize, font, Pink); Display("infolabel2" + symbol + ((j+1)*columnspacing), horizontal+((j+1)*100),vertical +((i+1)*18)) 。 ObjectSetText("infolabel2" +symbol+ ((j+1)*columnspacing), infolabel , fontsize, font, fontcolor); } } //---- 返回(0)。 } void Display(string name, int x, int y) { ObjectCreate(name,OBJ_LABEL, 0, 0, 0); ObjectSet(name, OBJPROP_CORNER, 0); ObjectSet(name, OBJPROP_XDISTANCE, x); ObjectSet(name, OBJPROP_YDISTANCE, y); ObjectSet(name, OBJPROP_BACK, FALSE); } Coding help ea coding HELP REQUIRED EA 不挂单请问怎么办?请高手看看 yinyang88 2015.05.26 06:24 #4764 nbtrading: 为什么你在两个循环中做完全相同的事情? 哦,我只是想用点画出一条线,以便于查看。 重要的 线是我有问题的多高。 谢谢你的提问。 tfi_markets 2015.05.27 06:07 #4765 "收盘买入 "和 "收盘卖出 "的算法 你好,专业编码人员。 我想知道是否有人能审查一下 "关闭买入 "和 "关闭卖出 "的算法。 EA在止损 或趋势变化发生后没有开新仓。 系统只是关闭头寸,下一个头寸将在新的趋势变化时打开,这导致了机会的丧失。 (请看屏幕截图)。 void CheckForClose() { RefreshRates()。 double cl_diCustom0 = iCustom(s_symbol,TenkanKijunTf, "Tenkan Sen-Kijun Sen",0,Tenkan,Kijun,0,bar) 。 double cl_diCustom1 = iCustom(s_symbol,TenkanKijunTf, "Tenkan Sen-Kijun Sen",0,Tenkan,Kijun,1,bar); double cl_diCustom2 = iCustom(s_symbol,TenkanKijunTf, "Tenkan Sen-Kijun Sen",0,Tenkan,Kijun,1,bar); double cl_diCustom3 = iCustom(s_symbol,TenkanKijunTf, "Tenkan Sen-Kijun Sen",0,Tenkan,Kijun,1,bar+1); double cl_diMA3 = iMA(s_symbol,MaTimeframe,MaPeriod,0,MaType,PRICE_CLOSE,bar); double cl_diMA4 = iMA(s_symbol,MaTimeframe,MaPeriod,0,MaType,PRICE_CLOSE,bar+1); for(int i=0;i<OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break; 如果(OrderMagicNumber()!= MAGIC)继续。 if(OrderSymbol() != s_symbol) continue; //+------------+ //| 收盘买入 | //+------------+ 如果(cl_diCustom0!=cl_diCustom1) //检查趋势 { 如果(OrderType()==OP_BUY) { 如果(cl_diCustom0<cl_diCustom1 && cl_diCustom2=cl_diMA4) { bool buyClose=OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier, clCloseBuy)。 如果(buyClose==false) { int ErrorCode = GetLastError(); string ErrDesc = ErrorDescription(ErrorCode); string ErrAlert= StringConcatenate("Close Buy Order - Error ",ErrorCode,": ",ErrDesc); 如果(ShowAlerts == true) Alert(ErrAlert); string ErrLog=StringConcatenate("Bid:",MarketInfo(s_symbol,MODE_BID)," Lots:",OrderLots()," Ticket:",OrderTicket())。 打印(ErrLog)。 } break; }// mod } } //+-------------+ //| 收盘卖出 | //+-------------+ 如果(cl_diCustom0!=cl_diCustom1) { 如果(OrderType()==OP_SELL) { 如果(cl_diCustom0>cl_diCustom1 && cl_diCustom2>cl_diMA3 && cl_diCustom3<=cl_diMA4) { bool sellClose= OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_ASK),Slippage*pipMultiplier,clCloseSell); 如果(sellClose == false) { ErrorCode = GetLastError(); ErrDesc = ErrorDescription(ErrorCode); ErrAlert=StringConcatenate("Close Sell Order - Error",ErrorCode,": ",ErrDesc)。 如果(ShowAlerts==true) Alert(ErrAlert); ErrLog=StringConcatenate("Ask:",MarketInfo(s_symbol,MODE_ASK)," Lots:",OrderLots()," Ticket:",OrderTicket())。 打印(ErrLog)。 } break; }// mod } } } } 附加的文件: notopennew_position.jpg 152 kb whisperer 2015.05.27 21:10 #4766 tfi_markets: 亲们好。我想知道是否有人能审查 "关闭买入 "和 "关闭卖出 "的算法。 EA在止损或趋势变化发生后没有开新仓。 系统只是关闭头寸,下一个头寸将在新的趋势变化时打开,这导致了机会的丧失。 (请看屏幕截图)。 修改一下。 for(int i=0;i<OrdersTotal(); i++) 改为这样 for(int i=OrdersTotal()-1;i>=0; i--) zigflip 2015.05.28 00:04 #4767 mladen: 让我们知道发生了什么 也许只是一个特定的metatrader版本的问题(我目前使用的是788版本)。 我的765版 Pruchik在这里提供了这个版本。 https://www.mql5.com/en/forum/173588 但需要额外的脚本来删除江恩sq9指标的线条,如果它被改变,在图表上留下线条。 vegadigitalco 2015.05.28 02:32 #4768 需要帮助这个显示信息的问题...... vegadigitalco: Hello Mladen & All senior Codder需要帮助解决这个显示信息的问题...... 无法获得实时报价,请帮助 //+------------------------------------------------------------------+ //|专家初始化功能 //+------------------------------------------------------------------+ #property indicator_chart_window double ExtMapBuffer1[]; extern int RSI_periode = 14; extern int RSI_level = 50; 外部颜色 BuyColor = clrLime; 外部颜色 SellColor = clrRed; 外来的int horizontal = 20; External int vertical = 50; 外置 int shift = 1; 外置双倍百分比 = 0.25; extern string fontmode = "Arial"; Extern int fontsize = 10; 外部颜色 fontcolor = clrSkyBlue; Extern int columnspacing = 100; int init() { //---- SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); //---- return(0); } //+------------------------------------------------------------------+ //|专家去初始化功能| //+------------------------------------------------------------------+ int deinit() { //---- ObjectsDeleteAll()。 ObjectDelete("INFO")。 //---- return(0); } //+------------------------------------------------------------------+ //|专家启动功能| //+------------------------------------------------------------------+ int start() { //---- string symlist2[] = {"NIFTY", "B.NIFTY", "XAUUSD", "GOLD" }; 字符串符号。 string info2[] = {MODE_HIGH,MODE_LOW,MODE_BID,MODE_ASK}; 字符串 infolabel。 string timeText[] = {"DayHigh", "DayLow", "Bid", "Ask" }; string font = "Terminal"; int counted_bars=IndicatorCounted(); int symlimit = ArraySize(symlist2); int timelimit = ArraySize(info2); for(int i=0;i<symlimit;i++) { 符号 = symlist2; 显示("symlabel" + symbol + i, horizontal,vertical)。 ObjectSetText("symlabel" + symbol + i, "SYMBOL", fontsize, font, Pink); Display("sym" + symbol + i, horizontal,vertical +((i+1)*18)); ObjectSetText("sym" + symbol + i, "" + symbol + "", fontsize, font, Yellow)。 for(int j=0;j<timelimit;j++) { infolabel = info2[j]; Display("infolabel" + j, horizontal+((j+1)*100), vertical); ObjectSetText("infolabel" + j, timeText[j], fontsize, font, Pink); Display("infolabel2" + symbol + ((j+1)*columnspacing), horizontal+((j+1)*100),vertical +((i+1)*18)) 。 ObjectSetText("infolabel2" +symbol+ ((j+1)*columnspacing), infolabel , fontsize, font, fontcolor); } } //---- 返回(0)。 } void Display(string name, int x, int y) { ObjectCreate(name, OBJ_LABEL, 0, 0, 0); ObjectSet(name, OBJPROP_CORNER, 0); ObjectSet(name, OBJPROP_XDISTANCE, x); ObjectSet(name, OBJPROP_YDISTANCE, y); ObjectSet(name, OBJPROP_BACK, FALSE); } AtApi 2015.05.28 02:52 #4769 我一直想写一个函数,从一个文本文件中读取数值并将其返回到一个字符串数组中,该文本文件由几行组成,每一行都是一个配对名称,除了第一行是配对的总数 例如。 7 CADJPY CHFJPY EURJPY GBPJPY NZDJPY USDJPY 澳元兑日元 我在metaquotes网站上找到了以下代码,但我被卡住了。我想创建一个字符串数组,在我读完文本中的第一行后,将其调整为这个值,然后用货币对的名称填充它...有人能帮我解决吗? int handle, NL,i,pos[]; string str,word; handle=FileOpen("test.txt",FILE_READ);//try to open file if(handle==-1)return(0);// if not exist if(FileSize(handle)==0){FileClose(handle); return(0); } //if empty while(!FileIsEnding(handle))//read file to the end by paragraph. if you have only one string, omit it { str=FileReadString(handle);//read one paragraph to the string variable if(str!="")//if string not empty { NL=0; for(i=0;i<StringLen(str);i++) { if(StringGetChar(str,i)==10)// look for newline (Charcode:10) only { NL++;//yes, we found one more newline ArrayResize(pos,NL);//increase array pos[NL-1]=i;//write the number of newline position to array } }//now we have array with numbers of positions of all newline for(i=0;i<=NL;i++)//start to read elements of string { if(i==0) word=StringSubstr(str,0,pos[0]);//the first element of string (in this case is the number 7) else word=StringSubstr(str,pos+1,pos-pos-1); } } } FileClose(handle); //close file return(0); Coding help need a little help Reading from TXT file yinyang88 2015.05.28 06:18 #4770 download38: 你好,编码大师。我试图编写一个PPO_alt指标,即图片a和b中的图1,但它在实时模式下不能正确绘制。 所以我尝试修改原始的PPO(图2),但它仍然不正确。 请看一下,你能不能解决这两个问题。 谢谢。 PS. 如果你不清楚,请多问几个问题。 谁能解释一下for(i=0; i=0; i--)和我们什么时候使用它们之间的区别? 谢谢。 1...470471472473474475476477478479480481482483484...786 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
你好,编程高手。
我试图编写一个PPO_alt指标,即图片a和b中的图1,但它在实时模式下不能正确绘制。
所以我尝试修改原始的PPO(图2),但它仍然不正确。 请看一下,你能不能解决这两个问题。
谢谢。
PS. 如果你不清楚,请提出更多问题。
你好,编码员大师。
我试图编写一个PPO_alt指标,即图片a和b中的图1,但它在实时模式下不能正确绘制。
所以我尝试修改原始的PPO(图2),但它仍然不正确。 请看一下,你能不能解决这两个问题。
谢谢。
PS. 如果你不清楚,请多提问题。为什么你在两个循环中做完全相同的事情?
你好,Mladen
需要帮助
无法获得实时报价,请帮助
//+------------------------------------------------------------------+
//|专家初始化功能
//+------------------------------------------------------------------+
#property indicator_chart_window
double ExtMapBuffer1[];
extern int RSI_periode = 14;
extern int RSI_level = 50;
外部颜色 BuyColor = clrLime;
外部颜色 SellColor = clrRed;
外来的int horizontal = 20;
External int vertical = 50;
外置 int shift = 1;
外置双倍百分比 = 0.25;
extern string fontmode = "Arial";
Extern int fontsize = 10;
外部颜色 fontcolor = clrSkyBlue;
Extern int columnspacing = 100;
int init()
{
//----
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
//----
return(0);
}
//+------------------------------------------------------------------+
//|专家去初始化功能|
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectsDeleteAll()。
ObjectDelete("INFO")。
//----
return(0);
}
//+------------------------------------------------------------------+
//|专家启动功能|
//+------------------------------------------------------------------+
int start()
{
//----
string symlist2[] = {"NIFTY", "B.NIFTY", "XAUUSD", "GOLD" };
字符串符号。
string info2[] = {MODE_HIGH,MODE_LOW,MODE_BID,MODE_ASK};
字符串 infolabel。
string timeText[] = {"DayHigh", "DayLow", "Bid", "Ask" };
string font = "Terminal";
int counted_bars=IndicatorCounted();
int symlimit = ArraySize(symlist2);
int timelimit = ArraySize(info2);
for(int i=0;i<symlimit;i++)
{
符号 = symlist2;
显示("symlabel" + symbol + i, horizontal,vertical)。
ObjectSetText("symlabel" + symbol + i, "SYMBOL", fontsize, font, Pink);
Display("sym" + symbol + i, horizontal,vertical +((i+1)*18));
ObjectSetText("sym" + symbol + i, "" + symbol + "", fontsize, font, Yellow)。
for(int j=0;j<timelimit;j++)
{
infolabel = info2[j];
Display("infolabel" + j, horizontal+((j+1)*100), vertical);
ObjectSetText("infolabel" + j, timeText[j], fontsize, font, Pink);
Display("infolabel2" + symbol + ((j+1)*columnspacing), horizontal+((j+1)*100),vertical +((i+1)*18)) 。
ObjectSetText("infolabel2" +symbol+ ((j+1)*columnspacing), infolabel , fontsize, font, fontcolor);
}
}
//----
返回(0)。
}
void Display(string name, int x, int y)
{
ObjectCreate(name,OBJ_LABEL, 0, 0, 0);
ObjectSet(name, OBJPROP_CORNER, 0);
ObjectSet(name, OBJPROP_XDISTANCE, x);
ObjectSet(name, OBJPROP_YDISTANCE, y);
ObjectSet(name, OBJPROP_BACK, FALSE);
}
为什么你在两个循环中做完全相同的事情?
哦,我只是想用点画出一条线,以便于查看。
重要的 线是我有问题的多高。
谢谢你的提问。
"收盘买入 "和 "收盘卖出 "的算法
你好,专业编码人员。
我想知道是否有人能审查一下 "关闭买入 "和 "关闭卖出 "的算法。
EA在止损 或趋势变化发生后没有开新仓。
系统只是关闭头寸,下一个头寸将在新的趋势变化时打开,这导致了机会的丧失。
(请看屏幕截图)。
void CheckForClose()
{
RefreshRates()。
double cl_diCustom0 = iCustom(s_symbol,TenkanKijunTf, "Tenkan Sen-Kijun Sen",0,Tenkan,Kijun,0,bar) 。
double cl_diCustom1 = iCustom(s_symbol,TenkanKijunTf, "Tenkan Sen-Kijun Sen",0,Tenkan,Kijun,1,bar);
double cl_diCustom2 = iCustom(s_symbol,TenkanKijunTf, "Tenkan Sen-Kijun Sen",0,Tenkan,Kijun,1,bar);
double cl_diCustom3 = iCustom(s_symbol,TenkanKijunTf, "Tenkan Sen-Kijun Sen",0,Tenkan,Kijun,1,bar+1);
double cl_diMA3 = iMA(s_symbol,MaTimeframe,MaPeriod,0,MaType,PRICE_CLOSE,bar);
double cl_diMA4 = iMA(s_symbol,MaTimeframe,MaPeriod,0,MaType,PRICE_CLOSE,bar+1);
for(int i=0;i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
如果(OrderMagicNumber()!= MAGIC)继续。
if(OrderSymbol() != s_symbol) continue;
//+------------+
//| 收盘买入 |
//+------------+
如果(cl_diCustom0!=cl_diCustom1) //检查趋势
{
如果(OrderType()==OP_BUY)
{
如果(cl_diCustom0<cl_diCustom1 && cl_diCustom2=cl_diMA4)
{
bool buyClose=OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier, clCloseBuy)。
如果(buyClose==false)
{
int ErrorCode = GetLastError();
string ErrDesc = ErrorDescription(ErrorCode);
string ErrAlert= StringConcatenate("Close Buy Order - Error ",ErrorCode,": ",ErrDesc);
如果(ShowAlerts == true) Alert(ErrAlert);
string ErrLog=StringConcatenate("Bid:",MarketInfo(s_symbol,MODE_BID)," Lots:",OrderLots()," Ticket:",OrderTicket())。
打印(ErrLog)。
}
break;
}// mod
}
}
//+-------------+
//| 收盘卖出 |
//+-------------+
如果(cl_diCustom0!=cl_diCustom1)
{
如果(OrderType()==OP_SELL)
{
如果(cl_diCustom0>cl_diCustom1 && cl_diCustom2>cl_diMA3 && cl_diCustom3<=cl_diMA4)
{
bool sellClose= OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_ASK),Slippage*pipMultiplier,clCloseSell);
如果(sellClose == false)
{
ErrorCode = GetLastError();
ErrDesc = ErrorDescription(ErrorCode);
ErrAlert=StringConcatenate("Close Sell Order - Error",ErrorCode,": ",ErrDesc)。
如果(ShowAlerts==true) Alert(ErrAlert);
ErrLog=StringConcatenate("Ask:",MarketInfo(s_symbol,MODE_ASK)," Lots:",OrderLots()," Ticket:",OrderTicket())。
打印(ErrLog)。
}
break;
}// mod
}
}
}
}
亲们好。
我想知道是否有人能审查 "关闭买入 "和 "关闭卖出 "的算法。
EA在止损或趋势变化发生后没有开新仓。
系统只是关闭头寸,下一个头寸将在新的趋势变化时打开,这导致了机会的丧失。
(请看屏幕截图)。
修改一下。
for(int i=0;i<OrdersTotal(); i++)
改为这样
for(int i=OrdersTotal()-1;i>=0; i--)
让我们知道发生了什么 也许只是一个特定的metatrader版本的问题(我目前使用的是788版本)。
我的765版
Pruchik在这里提供了这个版本。
https://www.mql5.com/en/forum/173588
但需要额外的脚本来删除江恩sq9指标的线条,如果它被改变,在图表上留下线条。
需要帮助这个显示信息的问题......
Hello Mladen & All senior Codder
需要帮助解决这个显示信息的问题......
无法获得实时报价,请帮助
//+------------------------------------------------------------------+
//|专家初始化功能
//+------------------------------------------------------------------+
#property indicator_chart_window
double ExtMapBuffer1[];
extern int RSI_periode = 14;
extern int RSI_level = 50;
外部颜色 BuyColor = clrLime;
外部颜色 SellColor = clrRed;
外来的int horizontal = 20;
External int vertical = 50;
外置 int shift = 1;
外置双倍百分比 = 0.25;
extern string fontmode = "Arial";
Extern int fontsize = 10;
外部颜色 fontcolor = clrSkyBlue;
Extern int columnspacing = 100;
int init()
{
//----
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
//----
return(0);
}
//+------------------------------------------------------------------+
//|专家去初始化功能|
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectsDeleteAll()。
ObjectDelete("INFO")。
//----
return(0);
}
//+------------------------------------------------------------------+
//|专家启动功能|
//+------------------------------------------------------------------+
int start()
{
//----
string symlist2[] = {"NIFTY", "B.NIFTY", "XAUUSD", "GOLD" };
字符串符号。
string info2[] = {MODE_HIGH,MODE_LOW,MODE_BID,MODE_ASK};
字符串 infolabel。
string timeText[] = {"DayHigh", "DayLow", "Bid", "Ask" };
string font = "Terminal";
int counted_bars=IndicatorCounted();
int symlimit = ArraySize(symlist2);
int timelimit = ArraySize(info2);
for(int i=0;i<symlimit;i++)
{
符号 = symlist2;
显示("symlabel" + symbol + i, horizontal,vertical)。
ObjectSetText("symlabel" + symbol + i, "SYMBOL", fontsize, font, Pink);
Display("sym" + symbol + i, horizontal,vertical +((i+1)*18));
ObjectSetText("sym" + symbol + i, "" + symbol + "", fontsize, font, Yellow)。
for(int j=0;j<timelimit;j++)
{
infolabel = info2[j];
Display("infolabel" + j, horizontal+((j+1)*100), vertical);
ObjectSetText("infolabel" + j, timeText[j], fontsize, font, Pink);
Display("infolabel2" + symbol + ((j+1)*columnspacing), horizontal+((j+1)*100),vertical +((i+1)*18)) 。
ObjectSetText("infolabel2" +symbol+ ((j+1)*columnspacing), infolabel , fontsize, font, fontcolor);
}
}
//----
返回(0)。
}
void Display(string name, int x, int y)
{
ObjectCreate(name, OBJ_LABEL, 0, 0, 0);
ObjectSet(name, OBJPROP_CORNER, 0);
ObjectSet(name, OBJPROP_XDISTANCE, x);
ObjectSet(name, OBJPROP_YDISTANCE, y);
ObjectSet(name, OBJPROP_BACK, FALSE);
}我一直想写一个函数,从一个文本文件中读取数值并将其返回到一个字符串数组中,该文本文件由几行组成,每一行都是一个配对名称,除了第一行是配对的总数
例如。
7
CADJPY
CHFJPY
EURJPY
GBPJPY
NZDJPY
USDJPY
澳元兑日元
我在metaquotes网站上找到了以下代码,但我被卡住了。我想创建一个字符串数组,在我读完文本中的第一行后,将其调整为这个值,然后用货币对的名称填充它...有人能帮我解决吗?
int handle, NL,i,pos[];
string str,word;
handle=FileOpen("test.txt",FILE_READ);//try to open file
if(handle==-1)return(0);// if not exist
if(FileSize(handle)==0){FileClose(handle); return(0); } //if empty
while(!FileIsEnding(handle))//read file to the end by paragraph. if you have only one string, omit it
{
str=FileReadString(handle);//read one paragraph to the string variable
if(str!="")//if string not empty
{
NL=0;
for(i=0;i<StringLen(str);i++)
{
if(StringGetChar(str,i)==10)// look for newline (Charcode:10) only
{
NL++;//yes, we found one more newline
ArrayResize(pos,NL);//increase array
pos[NL-1]=i;//write the number of newline position to array
}
}//now we have array with numbers of positions of all newline
for(i=0;i<=NL;i++)//start to read elements of string
{
if(i==0) word=StringSubstr(str,0,pos[0]);//the first element of string (in this case is the number 7)
else word=StringSubstr(str,pos+1,pos-pos-1);
}
}
}
FileClose(handle); //close file
return(0);
你好,编码大师。
我试图编写一个PPO_alt指标,即图片a和b中的图1,但它在实时模式下不能正确绘制。
所以我尝试修改原始的PPO(图2),但它仍然不正确。 请看一下,你能不能解决这两个问题。
谢谢。
PS. 如果你不清楚,请多问几个问题。谁能解释一下for(i=0; i=0; i--)和我们什么时候使用它们之间的区别?
谢谢。