help needed with code

denis68
56

i need help with the following code at the moment it only opens a order if AC is above or below zero and i want it to open if red changes to green and visa verser

double AC1 = iAC(NULL, 0, Current + 0);

double AC2 = iAC(NULL, 0, Current + 1);

if ((AC1 < AC2)) Order = SIGNAL_CLOSEBUY;

Eric Venturi-Bloxs
64655
denexer:
i need help with the following code at the moment it only opens a order if AC is above or below zero and i want it to open if red changes to green and visa verserdouble AC1 = iAC(NULL, 0, Current + 0);double AC2 = iAC(NULL, 0, Current + 1);if ((AC1 < AC2)) Order = SIGNAL_CLOSEBUY;

If you want avoid the current bar repainting:

double AC1 = iAC(NULL, 0, 1);double AC2 = iAC(NULL, 0, 2);if(AC1 > AC2) --> Exit Short and Entry Longif(AC1 Exit Long and Entry Short

Hope that helps.

FerruFx

denis68
56
denis68  

no i want to change to use the colors not not wether its above or below zero

i think i am on the right track now, but when i compile it i get error ACRed variable not defined :this is the code

double ACGreen = iAC(NULL, 0, Current + 0);

double ACRed = iAC(NULL, 0, Current + 1);

i see any difference between the green and the red, can somebody help me

Eric Venturi-Bloxs
64655
denexer:
no i want to change to use the colors not not wether its above or below zeroi think i am on the right track now, but when i compile it i get error ACRed variable not defined :this is the codedouble ACGreen = iAC(NULL, 0, Current + 0);double ACRed = iAC(NULL, 0, Current + 1);i see any difference between the green and the red, can somebody help me

The code I posted is for color change.

Look at your chart and you will see that when histo start to increase, it change red to green ... when it start to decrease, it change green to red.

FerruFx

denis68
56
denis68  

FerruFX

I would like to thank you for the help you are giving me, it seems i did not explain what i mean't very well, the color can change from red to green but its still under the 50 line what i need is when the color changes from red to green i want the green to be above the above the 50 line and below when it changes back to red,so its not the ea i should be looking at but changing the indicator, could you tell me how i do that.

Eric Venturi-Bloxs
64655
denexer:
FerruFXI would like to thank you for the help you are giving me, it seems i did not explain what i mean't very well, the color can change from red to green but its still under the 50 line what i need is when the color changes from red to green i want the green to be above the above the 50 line and below when it changes back to red,so its not the ea i should be looking at but changing the indicator, could you tell me how i do that.

I think you mean 0 line not 50 line.

Attached the version I just modified.

FerruFx

Files:
TheRumpledOne
2184
TheRumpledOne  

I think you wanted to know when the direction changed, as well as, when the price crossed the 0 line.

ACCELERATOR indicator, including source code, attached.

Files: