Add alert + email + place tardes Zigzig indicator - page 4

 
mladen:

rg1983

No need to close anything

Hi mladen , I have one question.

which function that I can use to identify if the low or the high of the previous candle is reached on the current bar.

what do you thinking about this :

if((OrderType()==OP_BUY && BidHigh[1]))

I'm looking for something that run with no stop with the movement of the price.

int start() is ok ?

Pls advise thanks

 
rg1983:

Hi mladen , I have one question.

which function that I can use to identify if the low or the high of the previous candle is reached on the current bar.

what do you thinking about this :

if((OrderType()==OP_BUY && BidHigh[1]))

I'm looking for something that run with no stop with the movement of the price.

int start() is ok ?

Pls advise thanks

rg1983

That way is OK (it just depends if you want to compare bid and ask to previous high/low or some other price, but that way is quite OK)

 

It works! I become an excellent programmer! Thanks mladen you have pushed me to learn mql4 programming thanks again.

I will return back here if i have more questions.

 
rg1983:
It works! I become an excellent programmer! Thanks mladen you have pushed me to learn mql4 programming thanks again. I will return back here if i have more questions.

Happy coding

 

Hi Mladen , I have a question hope u can help.

When I test the level of CCI of the previous bar for example iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 1) > 100 , it is not giving me sometime the same CCI level shown in the chart.

same thing for current bar iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL,0) > 100 . is there something wrong or missinng with my CCI parameters?

Thanks for your advise,

 
rg1983:
Hi Mladen , I have a question hope u can help.

When I test the level of CCI of the previous bar for example iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 1) > 100 , it is not giving me sometime the same CCI level shown in the chart.

same thing for current bar iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL,0) > 100 . is there something wrong or missinng with my CCI parameters?

Thanks for your advise,

All is OK with the iCCI() call

You should check if the parameters are exactly the same - otherwise they must be exactly the same

 
mladen:

All is OK with the iCCI() call

You should check if the parameters are exactly the same - otherwise they must be exactly the same

I have checked the parameters all is the same , it is strange when i get back to the chart to check results of CCI level it is often not the same.

Note that the trade will open on new bar when CCI reach level , it seems that the EA do not get the exact value of the previous bar CCI level and generate a false signal.

how can i fix that ?

is it a question of PRICE_TYPICAL ?

thanks

 
rg1983:

I have checked the parameters all is the same , it is strange when i get back to the chart to check results of CCI level it is often not the same.

Note that the trade will open on new bar when CCI reach level , it seems that the EA do not get the exact value of the previous bar CCI level and generate a false signal.

how can i fix that ?

is it a question of PRICE_TYPICAL ?

thanks

rg1983

PRICE_TYPICAL is not a problem as long as you use the same price in the indicator too

 

I think that the problem is with the first condition .

I need to check the level of CCI for previous bar first and then the level of the current bar and compare them.

What do you think if i use price close to check CCI level previous bar and open price to check CCI level current bar and compare them at the end of the condition?

this will avoid false signal? thanks

void OnTick()

{

int ticket = -1;

double price;

bool isNewBar = NewBar();

//Open Buy Order , instant signal is tested first

if(isNewBar //Send order when new bar opens

&& iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 0) > 100 && iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 0) >iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 1) //Commodity Channel Index > fixed value

)

{

RefreshRates();

price = Ask;

if(!TradeDayOfWeek()) return; //open trades only on specific days of the week

if(IsTradeAllowed())

{

ticket = myOrderSend(OP_BUY, price, TradeSize, "test");

if(ticket <= 0) return;

}

else //not autotrading => only send alert

myAlert("order", "test");

}

//Open Sell Order , instant signal is tested first

if(isNewBar //Send order when new bar opens

&& iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 0) < -100 && iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 0) <iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 1)//Commodity Channel Index < fixed value

)

{

RefreshRates();

price = Bid;

if(!TradeDayOfWeek()) return; //open trades only on specific days of the week

if(IsTradeAllowed())

{

ticket = myOrderSend(OP_SELL, price, TradeSize, "test");

if(ticket <= 0) return;

}

else //not autotrading => only send alert

myAlert("order", "test");

}
 
rg1983:
I think that the problem is with the first condition .

I need to check the level of CCI for previous bar first and then the level of the current bar and compare them.

What do you think if i use price close to check CCI level previous bar and open price to check CCI level current bar and compare them at the end of the condition?

this will avoid false signal? thanks

void OnTick()

{

int ticket = -1;

double price;

bool isNewBar = NewBar();

//Open Buy Order , instant signal is tested first

if(isNewBar //Send order when new bar opens

&& iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 0) > 100 && iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 0) >iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 1) //Commodity Channel Index > fixed value

)

{

RefreshRates();

price = Ask;

if(!TradeDayOfWeek()) return; //open trades only on specific days of the week

if(IsTradeAllowed())

{

ticket = myOrderSend(OP_BUY, price, TradeSize, "test");

if(ticket <= 0) return;

}

else //not autotrading => only send alert

myAlert("order", "test");

}

//Open Sell Order , instant signal is tested first

if(isNewBar //Send order when new bar opens

&& iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 0) < -100 && iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 0) <iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL, 1)//Commodity Channel Index < fixed value

)

{

RefreshRates();

price = Bid;

if(!TradeDayOfWeek()) return; //open trades only on specific days of the week

if(IsTradeAllowed())

{

ticket = myOrderSend(OP_SELL, price, TradeSize, "test");

if(ticket <= 0) return;

}

else //not autotrading => only send alert

myAlert("order", "test");

}

rg1983

The way you are checking cci, it will open order whenever the cci is > 100 and sloping up or cci is < -100 and sloping down. That is a lot of signals

Reason: