Как кодировать? - страница 102

 

мммм, пожалуйста, объясните подробнее об этом

также я попробовал boolean и if(), но на первый взгляд ничего не вышло.

 

Я не могу объяснить больше, если я не вижу больше...

но вы должны следовать основам...

double a=iCustom(indiA);

double b=iCustum(indiB);

double c=iCustom(indiC);

int ORDer=0;

if( a==1 && b>0 && c!=0 ) ORDer=1;

if( a==-1 && b<0 && c!=0 ) ORDer=-1;

if(ORDer==1) BUY();

if(ORDer==-1) SELL();

payback:
мммм, пожалуйста, объясните больше об этом, также я попробовал boolean и if(), но на первый взгляд ничего не получилось.
 

Хорошо, хорошо, хорошо!

Вот еще!

double

BuyValueCurrent,

SellValuePrevious,

SellValueCurrent,

BuyValuePrevious2,

BuyValueCurrent2,

SellValuePrevious2,

SellValueCurrent2,

BuyValueCurrent1min,

BuyValueCurrent5min,

BuyValueCurrent21min,

BuyValueCurrent25min,

SellValueCurrent1min,

SellValueCurrent5min,

SellValueCurrent21min,

SellValueCurrent25min,

TrendEnvUp,

TrendEnvDown,

TrendEnvUp1min,

TrendEnvUp5min,

TrendEnvDown1min,

TrendEnvDown5min,

Compra,

Vendi,

StopLong,

StopSell;

[/php]

the icustom funcions and buy sell

BuyValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,2);

BuyValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,1,0);

BuyValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName2,NumBars,0,2);

BuyValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,0,0);

SellValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);

SellValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,0,0);

SellValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);

SellValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,1,0);

BuyValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,1,0);

BuyValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,1,0);

BuyValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,0,0);

BuyValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,0,0);

SellValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,0,0);

SellValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,0,0);

SellValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,1,0);

SellValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,1,0);

TrendEnvUp = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0); // trendenvelopes

TrendEnvDown = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0); // trendenvelopes

TrendEnvUp1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);

TrendEnvUp5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);

TrendEnvDown1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);

TrendEnvDown5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);

BuyCondition = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE)&& (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE) ;

SellCondition = (SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE)&& (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE)&& (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE) ;

StopLong = ((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE));

StopSell = ((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE));

the exit condition

[php]

StopBuy = (SellValueCurrent !=0 && SellValueCurrent2 !=0 || TrendEnvDown != EMPTY_VALUE);

StopSell = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 || TrendEnvUp != EMPTY_VALUE);

 

измените их...

Таким образом, все условия ложны и остаются ложными, пока условия if() не станут истинными.

Удалите StopLong и StopSell в "double", все остальные "double" могут остаться.

Это сделает это за вас!

bool BuyCondition=false;

bool SellCondition=false;

bool StopLong=false;

bool StopSell=false;

if((BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE) && (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE)) {BuyCondition=true; }

if((SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE) && (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE) && (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE)) {SellCondition=true; }

if((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE)) {StopLong=true;}

if((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE)) {StopSell=true;}

payback:
хорошо, хорошо, хорошо!

вот еще!

double

BuyValueCurrent,

SellValuePrevious,

SellValueCurrent,

BuyValuePrevious2,

BuyValueCurrent2,

SellValuePrevious2,

SellValueCurrent2,

BuyValueCurrent1min,

BuyValueCurrent5min,

BuyValueCurrent21min,

BuyValueCurrent25min,

SellValueCurrent1min,

SellValueCurrent5min,

SellValueCurrent21min,

SellValueCurrent25min,

TrendEnvUp,

TrendEnvDown,

TrendEnvUp1min,

TrendEnvUp5min,

TrendEnvDown1min,

TrendEnvDown5min,

Compra,

Vendi,

StopLong,

StopSell;

[/php]the icustom funcions and buy sell

BuyValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,2);

BuyValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,1,0);

BuyValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName2,NumBars,0,2);

BuyValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,0,0);

SellValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);

SellValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,0,0);

SellValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);

SellValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,1,0);

BuyValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,1,0);

BuyValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,1,0);

BuyValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,0,0);

BuyValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,0,0);

SellValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,0,0);

SellValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,0,0);

SellValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,1,0);

SellValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,1,0);

TrendEnvUp = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0); // trendenvelopes

TrendEnvDown = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0); // trendenvelopes

TrendEnvUp1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);

TrendEnvUp5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);

TrendEnvDown1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);

TrendEnvDown5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);

BuyCondition = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE)&& (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE) ;

SellCondition = (SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE)&& (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE)&& (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE) ;

StopLong = ((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE));

StopSell = ((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE));

the exit condition

[php]

StopBuy = (SellValueCurrent !=0 && SellValueCurrent2 !=0 || TrendEnvDown != EMPTY_VALUE);

StopSell = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 || TrendEnvUp != EMPTY_VALUE);

 

Спасибо, я попробую сегодня вечером!

 

один глупый вопрос все что внутри {} это ваш комментарий или я должен его написать? и почему? почему {;} а не {};?

также могу ли я использовать этот комментарий правильно?

if(SellCondition)

{

ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order

subCheckError(ticket,"SELL");

LastTrade = "SELL";

return(0);

[/php]

or i have to write:

[php]

if(SellCondition = true)

{

ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order

subCheckError(ticket,"SELL");

LastTrade = "SELL";

return(0);

 

Нужна помощь в кодировании простого ea, пожалуйста...

Привет всем,

Я хотел бы поблагодарить всех, кто помог мне в прошлом. Сейчас у меня новая просьба.

Может ли кто-нибудь помочь мне закодировать эту еа и вот параметры:

Моя программа основана на баре дожи и внутреннем баре.

Для внутреннего бара :

Поместите BUY-STOP/BUY-LIMIT на HIGH следующего бара.

Поместите SELL-STOP/SELL-LIMIT на нижнем уровне следующего бара.

Разъяснения :

Внутренний бар - это бар 0 (нулевой)

Следующий бар - это место, где мы собираемся разместить лимит покупки и продажи или стоп.

Бар после следующего - это место, где будет срабатывать лонг или шорт.

На часовом графике, если у нас есть внутренний бар в 9 утра, то мы размещаем наши BUY-STOP или LIMIT и SELL-Stop otr LIMIT на максимуме и минимуме бара 10 утра. Сделка long или shor сработает на 11-часовом баре при условии, что цена пойдет выше или ниже 10-часового бара.

Для бара Дожи :

Разместите BUY-STOP/BUY-LIMIT на максимуме предыдущего бара.

Установите СТОП ПРОДАЖИ/ЛИМИТ ПРОДАЖИ на НИЗКОМ уровне предыдущего бара.

Разъяснения :

Бар Дожи - это бар 0 (нулевой)

Предыдущий бар или бар перед баром дожи является местом, где мы собираемся разместить лимит покупки и продажи или стоп на максимуме и минимуме.

Бар после бара дожи - это место, где будет срабатывать лонг или шорт.

На часовом графике, если у нас есть бар дожи в 9 утра, то мы размещаем наш BUY-STOP или LIMIT и SELL-Stop otr LIMIT на максимуме и минимуме бара 8 утра. Сделка long или shor сработает на 10-часовом баре при условии, что цена будет выше или ниже 8-часового бара.

...возможно, это не так просто. Если бы это было так, я бы сделал это 2 недели назад.

Заранее спасибо!

С наилучшими пожеланиями,

forexcel

 

это не комментарии, это код.

Они являются частью вашего оператора if().

if(SellCondition){

...

return(0);

}

if(SellCondition==true){

...

return(0);

}

Оба утверждения в порядке, вы можете использовать одно из них...

но обратите внимание, что каждый оператор if() закрывается символом }

это не отображается в вашем коде, который вы приводите здесь.

другой пример:

if(a==b){c=1; d=2; return(0);}

payback:
один глупый вопрос, все что внутри {} это ваш комментарий или я должен его написать? и почему? почему {;} а не {};?

могу ли я использовать это утверждение?

if(SellCondition)

{

ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order

subCheckError(ticket,"SELL");

LastTrade = "SELL";

return(0);

[/php]

or i have to write:

[php]

if(SellCondition = true)

{

ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order

subCheckError(ticket,"SELL");

LastTrade = "SELL";

return(0);

 

аххххх я все прекрасно понял thx!!!!

Я просматриваю свою тройку из колледжа, это то же самое.

в любом случае, большое спасибо!!!

 

нашел несколько индикаторов для начала...

есть также советник, но он не очень хорошо работает, я думаю, просто сделал быстрый тест...

Файлы:
Причина обращения: