Jump to content

(ASK)How to add variable to this code


zoop

Recommended Posts

hi i another question

 

how to make the AO indicator filter trigger setting user variable?

 

at the moment its set to AO sell only above 0

 

and buy only below 0

 

how would i make it so it can be adjusted in settings in the ea by user ?

 

so i can adjust it to i sell above .00185 and buy below -.00125 or any other setting

 

 

double ao=iAO(NULL,aotimeframe,aoshift);
  
  
  
  
bool aobuy=false;

bool aosell=false;
  
  
 if (aofilter==false || (aofilter && ao<0))  aosell=true;
  
  if (aofilter==false || (aofilter && ao>0)) aobuy=true;

 

 

much thanks

Link to comment
Share on other sites

Re: (ASK)How to add variable to this code

 

Hi zoop,

 

Good day,

 

I believe you want to change the code so it works on different variables.

 

In this case you have the option as well to make this variable controllable from an external function and change it whenever you want.

 

Look here:

 


//on top of the EA, you add external function

extern value_1 = 0.00185;
extern value_2 = -0.00125;
---------------------

double ao=iAO(NULL,aotimeframe,aoshift);
  
     
bool aobuy=false;

bool aosell=false;
  
  
 if (aofilter==false || (aofilter && ao<value_1))  aosell=true;
  
  if (aofilter==false || (aofilter && ao>value_2)) aobuy=true;

 

I hope this is useful.

 

Best wishes,

a New Year 2011 has come, and the challenge has just started 8-)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...