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

 

yes but on newbar , means when the first bar cross the level order will be placed on next bar when condition is met.

and of course it is just a part of my code there is other conditions and filters when order is placed.

what do you think about this in case of buy order : my aim is to ensure that the CCi level is crossed and maintained on previous bar , and CCI level previous bar < CCi level current bar in case of buy.

if(isNewBar //Send order when new bar opens

&& iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL,1) > 100 && 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

)

any suggestions? thanks

 
rg1983:
yes but on newbar , means when the first bar cross the level order will be placed on next bar when condition is met.

and of course it is just a part of my code there is other conditions and filters when order is placed.

what do you think about this in case of buy order : my aim is to ensure that the CCi level is crossed and maintained on previous bar , and CCI level previous bar < CCi level current bar in case of buy.

if(isNewBar //Send order when new bar opens

&& iCCI(NULL, PERIOD_CURRENT, 20, PRICE_TYPICAL,1) > 100 && 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

)

any suggestions? thanks

rg1983

You should do something like this

if cciPrevious+100

if cciPrevious>-100 and cciCurrent<-100

 

Thanks mladen , that's great but as you know I enter trade only on next candle when cci level is reached.

I use the 200 EMA and 20 MA to know direction but have you another suggestion , something great for trend detection.

Thanks

 
rg1983:
Thanks mladen , that's great but as you know I enter trade only on next candle when cci level is reached.

I use the 200 EMA and 20 MA to know direction but have you another suggestion , something great for trend detection.

Thanks

rg1983

Then test vars 1 and 2 - that way you shall have the cross for the first closed bar

 
mladen:

rg1983

Then test vars 1 and 2 - that way you shall have the cross for the first closed bar

Hello mladen, i not sure understand what do you mean by vars 1 and 2?

Another question : how i can get the number of the bar before the bar of the opened trade in order to determinate the low and the high of that bar. I use this High and Low.

Of course i use select order function but it works only for high on the bar of the trade open and not working for low.

Any help thanks!

 

I get the vars 1 and 2 means bar1 and bar2 ok i will give a try.

Could you help to check the right use of ibarShift function thanks

 
rg1983:
I get the vars 1 and 2 means bar1 and bar2 ok i will give a try. Could you help to check the right use of ibarShift function thanks

rg1983

You do not need to use iBarShift in the example you posted

Simply use fixed constant values for bar numbers

 
mladen:

rg1983

You do not need to use iBarShift in the example you posted

Simply use fixed constant values for bar numbers

Thanks for your quick reply ! I have already used the fixed constant but i need really get the high and low of the bar previous the bar open trade for my stop loss.

example of 30m Time Frame : Bar at 9h ...Open buy order at 9h30 Bar ... the price will go up by 5 pip on next bar at 10h and than go down by 10 pip on 10h30 but not exceed the low of the first bar at 9h .

If I use the constant value the trade will be closed at low of the bar at 10h .

What i need is to close trade at the low of the bar 9h . I hope all is clear.

 
rg1983:

Thanks for your quick reply ! I have already used the fixed constant but i need really get the high and low of the bar previous the bar open trade for my stop loss.

example of 30m Time Frame : Bar at 9h ...Open buy order at 9h30 Bar ... the price will go up by 5 pip on next bar at 10h and than go down by 10 pip on 10h30 but not exceed the low of the first bar at 9h .

If I use the constant value the trade will be closed at low of the bar at 10h .

What i need is to close trade at the low of the bar 9h . I hope all is clear.

rg1983

To use the previous bars values simply use 1 for shift (2 for 2 bars ago, and so on)

 
mladen:

rg1983

To use the previous bars values simply use 1 for shift (2 for 2 bars ago, and so on)

but in case of unknown shift of previous bar : is that ok ?

High and Low.

I have tried with no success

Reason: