if (prevshortcurrentlong && currentshort>currentlong>Trendsetter && Ask > resistance - upperproximity*Point){ //---conditions to open long positions change as desired
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES )) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
//+---------enter short positions----------+
if (prevshort>prevlong && currentshort<currentlong && currentshort<currentlong<Trendsetter && Ask < support + lowerproximity*Point){ //---conditions to open short positions change as desired
이해가 되는군요... 그래서 여기에 경쟁적인 마감 전략이 있는 것 같습니다... CloseOrder()는 내가 의도한 것을 수행하기 위해 결코 해결되지 않은 거래 기능 의 정시 마감과 관련이 있습니다. 그래서 나는 당분간 그리고 현재 목적을 위해 나는 그것을 삭제한다. 어?..누군가 나에게 코드를 끄는 멋진 트릭을 보여 주었는데 "//"를 줄 앞에 추가하기만 하면 됩니다...
여기 모든 것이 ....있는 그대로 ..
#property copyright "Copyright 2006, Aaragorn"
//+--------- settings may vary use at your own risk-----------------+
#include
//+--------------user inputs--------------------+
extern double Trendsetter = 250;
extern double Minortrendsetter = 150;
extern double LongEMA = 20;
extern double ShortEMA = 5;
extern double TrailingStop = 15;
extern double TrailingStopTrigger = 1;
extern double StopLoss = 186;
extern double TakeProfit = 250;
extern double Lots = 0.1;
extern double EquityStop = 9;
extern int Slippage = 3;
#define trade 0
#define MagicNum 0
//---- Custom "Channel-1" Indicator and Filter Parameters
extern int Hours=36;
extern color col=SkyBlue;
extern double TF = 60; //--which bar period for the custom indicator to use
extern double upperproximity = 30; //---disallows long orders within this proximity to resistance line
extern double lowerproximity = 30; //---disallows short orders within this proximity to the support line
//+-----------close based on not triggering trailing stop in allotted time----------------+
extern int MonitorInMinutes = 60; // minutes after open to check state of trade
extern int ThresholdMove = 11; // if after that time we don't have +'x' pips we will exit
extern int MinsMultiplier = 600; // multiplies the MonitorInMinutes to make minutes (if 'x'=60) into hours
//+----------------------end of allotted time user inputs-----------------------------+
//+-----------------------------end of user inputs----------------------------------+
if (prevshortcurrentlong && currentshort>currentlong>Trendsetter && Ask > resistance - upperproximity*Point){ //---conditions to open long positions change as desired
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES )) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
//+---------enter short positions----------+
if (prevshort>prevlong && currentshort<currentlong && currentshort<currentlong<Trendsetter && Ask < support + lowerproximity*Point){ //---conditions to open short positions change as desired
Maji: 알겠습니다. 아직 이메일이 오기를 기다리고 있습니다. 그래서... 죽일 시간이 몇 분 더 있습니다. closeall 함수를 잘라내어 시작 루프 외부에 붙여넣어야 합니다. 별도의 기능입니다. 그런 다음 거래를 마감하려는 시작 루프에서 closeall 함수를 호출해야 합니다. 더 진행하기 전에 함수를 호출하는 이 개념을 공부해야 한다고 생각합니다.
지금까지 편집기에서 함수에 대해 볼 수 있는 것과 달리 매개변수를 찾고 있고 ()에 지정된 항목이 표시되지 않습니다.
모든 회원에게 제안합니다. "카운트업" 루틴을 사용하여 거래를 마감하지 마십시오. 예를 들어 다음과 같은 것을 사용하지 마십시오.
(i = 0; i<t; i++)
{
if(주문선택(tik,SELECT_BY_TICKET)){
이중 가격 = 입찰가;
if (op == OP_SELL) prc = 묻다;
CloseOrder(tik, OrderLots(), prc);
}
여러 주문을 사용하는 경우 마지막 주문이 마감되지 않습니다. "카운트다운" 루틴을 사용합니다. 다음은 이 짜증나는 "버그"를 처음 발견했을 때 Metaquotes 개발자와의 토론입니다.
http://www.metaquotes.net/forum/2018/좋아, 어떻게 해야 합니까? 그리고 이 라인은 내가 원하는 대로 할 것인가?
if (prc == 입찰가 && 현재 장기 소액주):
모든 회원에게 제안합니다. "카운트업" 루틴을 사용하여 거래를 마감하지 마십시오. 예를 들어 다음과 같은 것을 사용하지 마십시오.
(i = 0; i<t; i++)
{
if(주문선택(tik,SELECT_BY_TICKET)){
이중 prc = 입찰가;
if (op == OP_SELL) prc = 묻다;
CloseOrder(tik, OrderLots(), prc);
}
여러 주문을 사용하는 경우 마지막 주문이 마감되지 않습니다. "카운트 다운" 루틴을 사용하십시오. 다음은 이 짜증나는 "버그"를 처음 발견했을 때 Metaquotes 개발자와의 토론입니다.
http://www.metaquotes.net/forum/2018/좋아, 어떻게 해야 합니까? 그리고 이 라인은 내가 원하는 대로 할 것인가?
if (prc == Bid && currentlong minorts);
{
if(OrderSelect(tik,SELECT_BY_TICKET)){
double prc = Bid;
if (op == OP_SELL) prc = Ask;
if (prc == Bid && currentlong minorts);
CloseOrder(tik, OrderLots(), prc);이전 포스팅에 올렸던 링크를 참고해주세요. 해당 링크에 샘플 코드가 있습니다.
이전 포스팅에 올렸던 링크를 참고해주세요. 해당 링크에 샘플 코드가 있습니다.
샘플에서 이 라인이 보이네요..
for(trade=OrdersTotal()-1;trade>=0;trade--){
앞으로 세는 대신 뒤로 세는 아이디어를 얻는 동안
이것은 두 자리를 세는 것이 맞습니까?
{
int tik[30], t = 0;
for(int i =0;i<OrdersTotal();i++){//------counting forward error here
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
if(OrderSymbol()==Symbol() && MagicNum==OrderMagicNumber() && OrderType() == op){
tik[t] = OrderTicket(); t++;
}
}
}
for (i = 0; i<t; i++)//------counting forward error here
{
if(OrderSelect(tik,SELECT_BY_TICKET)){
double prc = Bid;
if (op == OP_SELL) prc = Ask;
CloseOrder(tik, OrderLots(), prc);
}
}
}어떻게 바꿔야할지 막막했는데...혹시...
for(int i =0;i>OrdersTotal();i--){
그리고
(i = 0; i>t; i--)
나는 여전히 크로스백에 대해 머리를 쓰려고 노력하고 있습니다.
다음은 종소리와 휘파람이 없는 평범한 바닐라 클로징 루틴의 예입니다. 코드가 발을 적실 정도로 간단하다고 생각합니다.
void CloseAll()
{
int trade;
for(trade=OrdersTotal()-1;trade>=0;trade--)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol())
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()== MagicNum)
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Blue);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Red);
}
}
}
다음은 종소리와 휘파람이 없는 평범한 바닐라 클로징 루틴의 예입니다. 코드가 발을 적실 정도로 간단하다고 생각합니다.
void CloseAll()
{
int trade;
for(trade=OrdersTotal()-1;trade>=0;trade--)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol())
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()== MagicNum)
{
if(OrderType()==OP_BUY && currentlong > minorts)//---I want to close long positions when the ema's crossback down
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Blue);
if(OrderType()==OP_SELL) && currentlong < minorts)//---I want to close short positions when the ema's crossback up
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Red);
}
}
}
}
좋아, 평범한 바닐라, 그게 더 좋아...
I get these errors when I paste this in...
'(' - function definition unexpected C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (85, 14)
'trade' - variable not defined C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (88, 6)
'trade' - variable not defined C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (88, 28)
'trade' - variable not defined C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (88, 37)
'trade' - variable not defined C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (90, 15)
'MagicNum' - variable not defined C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (94, 54)
'Slippage' - variable not defined C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (97, 46)
')' - unbalanced right parenthesis C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (99, 53)
'Slippage' - variable not defined C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (100, 46)
')' - unbalanced right parenthesis C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (100, 58)
'}' - unbalanced parentheses C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (104, 1)
11 error(s), 0 warning(s)
[/PHP]
I don't know why it says 'trade' is an error it looks like trade is defined as an 'int'
ok whatever...so...let's see...
//+--------- settings may vary use at your own risk-----------------+
#include
//+--------------user inputs--------------------+
extern double Trendsetter = 250;
extern double Minortrendsetter = 150;
extern double LongEMA = 20;
extern double ShortEMA = 5;
extern double TrailingStop = 15;
extern double TrailingStopTrigger = 1;
extern double StopLoss = 186;
extern double TakeProfit = 250;
extern double Lots = 0.1;
extern double EquityStop = 9;
extern int Slippage = 3;
#define trade 0
#define MagicNum 0
//---- Custom "Channel-1" Indicator and Filter Parameters
extern int Hours=36;
extern color col=SkyBlue;
extern double TF = 60; //--which bar period for the custom indicator to use
extern double upperproximity = 30; //---disallows long orders within this proximity to resistance line
extern double lowerproximity = 30; //---disallows short orders within this proximity to the support line
//+-----------close based on not triggering trailing stop in allotted time----------------+
extern int MonitorInMinutes = 60; // minutes after open to check state of trade
extern int ThresholdMove = 11; // if after that time we don't have +'x' pips we will exit
extern int MinsMultiplier = 600; // multiplies the MonitorInMinutes to make minutes (if 'x'=60) into hours
//+----------------------end of allotted time user inputs-----------------------------+
//+-----------------------------end of user inputs----------------------------------+
//+------------------------------------------------------------------+
//| expert start function
//+------------------------------------------------------------------+
int start(){
CloseOrder();
int cnt, ticket;
if(Bars<100){
Print("bars less than 100");
return(0);
}
//+----------------------Get Moving Average(s) Data----------------------------------------+
double currentlong=iMA(NULL,0,LongEMA,0,MODE_EMA,PRICE_CLOSE,0);//--current period longEMA
double currentshort=iMA(NULL,0,ShortEMA,0,MODE_EMA,PRICE_CLOSE,0);//--current period shortEMA
double trendsetter=iMA(NULL,0,Trendsetter,0,MODE_EMA,PRICE_CLOSE,0);//--current period TrendsetterEMA
double minorts=iMA(NULL,0,Minortrendsetter,0,MODE_EMA,PRICE_CLOSE,0);//--current period MinortrendsetterEMA
double prevlong=iMA(NULL,0,LongEMA,0,MODE_EMA,PRICE_CLOSE,1);//--previous period longEMA
double prevshort=iMA(NULL,0,ShortEMA,0,MODE_EMA,PRICE_CLOSE,1);//--previous period shortEMA
double prevtrendsetter=iMA(NULL,0,Trendsetter,0,MODE_EMA,PRICE_CLOSE,1);//--previous period TrendsetterEMA
double prevminorts=iMA(NULL,0,Minortrendsetter,0,MODE_EMA,PRICE_CLOSE,1);//--previous period MinortrendsetterEMA
//+----------------------------end of Get Moving Average(s) Data-----------------------------+
//+--------------------channel filter---------------------------+
double resistance = iCustom(NULL,TF,"Channel-1",Hours,col,0,0);
double support = iCustom(NULL,TF,"Channel-1",Hours,col,2,0);
//+------------------- end channel filter------------------------+
//+---------Obnoxious money management code needs revision-----------------+
int total=OrdersTotal();
if(total<1){
if(AccountFreeMargin()<(1000*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
//+---------end of Obnoxious money management code-----------------+
//+---------------------------------------Order Entry--------------------------------------------+
//+---------enter long positions----------+
if (prevshortcurrentlong && currentshort>currentlong>Trendsetter && Ask > resistance - upperproximity*Point){ //---conditions to open long positions change as desired
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point, NULL,16384,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);
}
//+---------enter short positions----------+
if (prevshort>prevlong && currentshort<currentlong && currentshort<currentlong<Trendsetter && Ask < support + lowerproximity*Point){ //---conditions to open short positions change as desired
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point, NULL,16384,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);
}
}
//+---------end of order entry-------------------------+
//+------close on moving average cross-----------------+
void CloseAll()
{
int trade;
for(trade=OrdersTotal()-1;trade>=0;trade--)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol())
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()== MagicNum)
{
if(OrderType()==OP_BUY && currentlong > minorts)//---I want to close long positions when the ema's crossback down
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Blue);
if(OrderType()==OP_SELL && currentlong < minorts)//---I want to close short positions when the ema's crossback up
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Red);
}
}
}
}
//+--------end of close on moving average cross--------+now by adding this
extern int Slippage = 3;
#define trade 0
#define MagicNum 0
I'm down to...
[PHP]Compiling 'whatever.mq4'...
'(' - function definition unexpected C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (87, 14)
'}' - unbalanced parentheses C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (106, 1)
2 error(s), 0 warning(s)
I don't know what to do about these two.
[PHP]//+------close on moving average cross-----------------+
void CloseAll()//function definition unexpected error occurs here
{
int trade;
for(trade=OrdersTotal()-1;trade>=0;trade--)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol())
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()== MagicNum)
{
if(OrderType()==OP_BUY && currentlong > minorts)//---I want to close long positions when the ema's crossback down
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Blue);
if(OrderType()==OP_SELL && currentlong < minorts)//---I want to close short positions when the ema's crossback up
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Red);
}
}
}
}//--------unblanced parentheses error occurs here
"CloseOrder();" 함수 를 어디에서 정의했습니까? 내가 올린 닫는 함수의 이름이 달랐다... CloseAll()
그것이 문제를 해결하는지 확인하십시오.
이해가 되는군요... 그래서 여기에 경쟁적인 마감 전략이 있는 것 같습니다... CloseOrder()는 내가 의도한 것을 수행하기 위해 결코 해결되지 않은 거래 기능 의 정시 마감과 관련이 있습니다. 그래서 나는 당분간 그리고 현재 목적을 위해 나는 그것을 삭제한다. 어?..누군가 나에게 코드를 끄는 멋진 트릭을 보여 주었는데 "//"를 줄 앞에 추가하기만 하면 됩니다...
여기 모든 것이 ....있는 그대로 ..
//+--------- settings may vary use at your own risk-----------------+
#include
//+--------------user inputs--------------------+
extern double Trendsetter = 250;
extern double Minortrendsetter = 150;
extern double LongEMA = 20;
extern double ShortEMA = 5;
extern double TrailingStop = 15;
extern double TrailingStopTrigger = 1;
extern double StopLoss = 186;
extern double TakeProfit = 250;
extern double Lots = 0.1;
extern double EquityStop = 9;
extern int Slippage = 3;
#define trade 0
#define MagicNum 0
//---- Custom "Channel-1" Indicator and Filter Parameters
extern int Hours=36;
extern color col=SkyBlue;
extern double TF = 60; //--which bar period for the custom indicator to use
extern double upperproximity = 30; //---disallows long orders within this proximity to resistance line
extern double lowerproximity = 30; //---disallows short orders within this proximity to the support line
//+-----------close based on not triggering trailing stop in allotted time----------------+
extern int MonitorInMinutes = 60; // minutes after open to check state of trade
extern int ThresholdMove = 11; // if after that time we don't have +'x' pips we will exit
extern int MinsMultiplier = 600; // multiplies the MonitorInMinutes to make minutes (if 'x'=60) into hours
//+----------------------end of allotted time user inputs-----------------------------+
//+-----------------------------end of user inputs----------------------------------+
//+------------------------------------------------------------------+
//| expert start function
//+------------------------------------------------------------------+
int start(){
//+--turned off--+CloseOrder();
int cnt, ticket;
if(Bars<100){
Print("bars less than 100");
return(0);
}
//+----------------------Get Moving Average(s) Data----------------------------------------+
double currentlong=iMA(NULL,0,LongEMA,0,MODE_EMA,PRICE_CLOSE,0);//--current period longEMA
double currentshort=iMA(NULL,0,ShortEMA,0,MODE_EMA,PRICE_CLOSE,0);//--current period shortEMA
double trendsetter=iMA(NULL,0,Trendsetter,0,MODE_EMA,PRICE_CLOSE,0);//--current period TrendsetterEMA
double minorts=iMA(NULL,0,Minortrendsetter,0,MODE_EMA,PRICE_CLOSE,0);//--current period MinortrendsetterEMA
double prevlong=iMA(NULL,0,LongEMA,0,MODE_EMA,PRICE_CLOSE,1);//--previous period longEMA
double prevshort=iMA(NULL,0,ShortEMA,0,MODE_EMA,PRICE_CLOSE,1);//--previous period shortEMA
double prevtrendsetter=iMA(NULL,0,Trendsetter,0,MODE_EMA,PRICE_CLOSE,1);//--previous period TrendsetterEMA
double prevminorts=iMA(NULL,0,Minortrendsetter,0,MODE_EMA,PRICE_CLOSE,1);//--previous period MinortrendsetterEMA
//+----------------------------end of Get Moving Average(s) Data-----------------------------+
//+--------------------channel filter---------------------------+
double resistance = iCustom(NULL,TF,"Channel-1",Hours,col,0,0);
double support = iCustom(NULL,TF,"Channel-1",Hours,col,2,0);
//+------------------- end channel filter------------------------+
//+---------Obnoxious money management code needs revision-----------------+
int total=OrdersTotal();
if(total<1){
if(AccountFreeMargin()<(1000*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
//+---------end of Obnoxious money management code-----------------+
//+---------------------------------------Order Entry--------------------------------------------+
//+---------enter long positions----------+
if (prevshortcurrentlong && currentshort>currentlong>Trendsetter && Ask > resistance - upperproximity*Point){ //---conditions to open long positions change as desired
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point, NULL,16384,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);
}
//+---------enter short positions----------+
if (prevshort>prevlong && currentshort<currentlong && currentshort<currentlong<Trendsetter && Ask < support + lowerproximity*Point){ //---conditions to open short positions change as desired
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point, NULL,16384,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);
}
}
//+---------end of order entry-------------------------+
//+------close on moving average cross-----------------+
void CloseAll()//function definition unexpected error occurs here
{
int trade;
for(trade=OrdersTotal()-1;trade>=0;trade--)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol())
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()== MagicNum)
{
if(OrderType()==OP_BUY && currentlong > minorts)//---I want to close long positions when the ema's crossback down
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Blue);
if(OrderType()==OP_SELL && currentlong < minorts)//---I want to close short positions when the ema's crossback up
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Red);
}
}
}
}//--------unblanced parentheses error occurs here
//+--------end of close on moving average cross--------+
//+-------------------------Trailing Stop Code------------------------------------+
for(cnt=0;cnt<total;cnt++) {
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol()) {
if(OrderType()==OP_BUY){
if(TrailingStop>0) {if(Bid-OrderOpenPrice()>Point*TrailingStopTrigger) {
if(OrderStopLoss()<Bid-Point*TrailingStop) {
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}else{
if(TrailingStop>0) {if((OrderOpenPrice()-Ask)>(Point*TrailingStopTrigger)) {
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0)) {
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
//+-------------------------End of Trailing Stop Code----------------------------+
//+---------------------Equity Stop Code---------------------------+
if((AccountEquity()+ EquityStop)<AccountBalance()) {
{
int ttotal = OrdersTotal();
for(int i=ttotal-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
bool result = false;
switch(type)
{
//Close opened long positions
case OP_BUY : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
break;
//Close opened short positions
case OP_SELL : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
}
if(result == false)
{
Alert("Order " , OrderTicket() , " failed to close. Error:" , GetLastError() );
Sleep(3000);
}
}
return(0);
}
}
}
}
}
//+---------------------End of Equity Stop Code---------------------------+
//|
//+---------------------Close Based on Time-------------------------------+
//+--------------needs revision, not working as desired---------------------+
//+------------I want it to close IF and ONLY IF trailing stop is NOT triggered-------------+
//+--turned off--+void CloseOrder()
//+--turned off--+{
//+--turned off--+ double Profit=ThresholdMove*Point;
//+--turned off--+ int total = OrdersTotal();
//+--turned off--+ for (int cnt = 0 ; cnt < total ; cnt++)
//+--turned off--+ {
//+--turned off--+ OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
//+--turned off--+ if ((CurTime()-OrderOpenTime())>MonitorInMinutes*60*MinsMultiplier)
//+--turned off--+ {
//+--turned off--+ if(OrderSymbol()==Symbol() && OrderType()==OP_BUY && Bid-Profit<OrderOpenPrice() )
//+--turned off--+ {
//+--turned off--+ OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
//+--turned off--+ }
//+--turned off--+ if(OrderSymbol()==Symbol() && OrderType()==OP_SELL && Bid+Profit>OrderOpenPrice())
//+--turned off--+ {
//+--turned off--+ OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
//+--turned off--+ }
//+--turned off--+ }
//+--turned off--+ }
//+--turned off--+}
//+---------------------------end of close on time code---------------+컴파일시 동일한 두 가지 오류가 계속 발생합니다.
알겠습니다. 아직 이메일이 오기를 기다리고 있습니다. 그래서... 죽일 시간이 몇 분 더 있습니다.
closeall 함수 를 잘라내어 시작 루프 외부에 붙여넣어야 합니다. 별도의 기능입니다. 그런 다음 거래를 마감하려는 시작 루프에서 closeall 함수를 호출해야 합니다. 더 진행하기 전에 함수를 호출하는 이 개념을 공부해야 한다고 생각합니다.
알겠습니다. 아직 이메일이 오기를 기다리고 있습니다. 그래서... 죽일 시간이 몇 분 더 있습니다. closeall 함수를 잘라내어 시작 루프 외부에 붙여넣어야 합니다. 별도의 기능입니다. 그런 다음 거래를 마감하려는 시작 루프에서 closeall 함수를 호출해야 합니다. 더 진행하기 전에 함수를 호출하는 이 개념을 공부해야 한다고 생각합니다.
지금까지 편집기에서 함수에 대해 볼 수 있는 것과 달리 매개변수를 찾고 있고 ()에 지정된 항목이 표시되지 않습니다.
..당신은 내가 '자르기'하고 '시작 루프 외부에 붙여넣기'해야 한다고 말합니다
//| expert start function
//+------------------------------------------------------------------+
CloseAll();
int start(){
//+--turned off--+CloseOrder(); [/PHP]
this gives the same two errors plus this error
'CloseAll' - expression on global scope not allowed C:\Program Files\Interbank FX Trader 4-live mini\experts\whatever.mq4 (33, 1)
when I put it next to where the other one was like this...
[PHP]int start(){
//+--turned off--+CloseOrder();
CloseAll();그것은 전혀 차이가 없는 것처럼 여전히 두 개의 오류를 페이지 아래에 남겨둡니다. 이 함수 호출을 전혀 이해하지 못하는 것이 맞습니다.
이 작업을 수행하는 방법을 알고 있습니까?
나는 여기 http://www.metatrader.info/node/53 를 보고 있다. 나는 무엇이 잘못되었는지 알지 못한다.