How EA can read my ENUM choice?

To add comments, please log in or register
Tim Rittel
275
Tim Rittel  

Hy,

how is it possible for my Ea to read my Enum-Choice?

enum selectChoice
  {
   Banan=0,     // lolol
   Apple=1,     // lala
  };
input selectChoice WhatIlikeMost=Apple;

//later in EA..

if(WhatIlikeMost==Apple) //Do my stuff...;

// Thats how i did it, and it doesnt work...Do You know better?
hiroshitiu
22
hiroshitiu  
Do not assign numerical values into the custom enum.
Fernando Carreiro
5000
Fernando Carreiro  
hiroshitiu: Do not assign numerical values into the custom enum.

That has nothing to do with it! You can assign numerical values or not!

Fernando Carreiro
5000
Fernando Carreiro  
Tim Rittel: how is it possible for my Ea to read my Enum-Choice?

Your sample code will not even compile because of the extra comma after the "Apple=1", so show your real code:

enum selectChoice
  {
   Banan=0,     // lolol
   Apple=1,     // lala
  };
input selectChoice WhatIlikeMost=Apple;

//later in EA..

if(WhatIlikeMost==Apple) //Do my stuff...;

// Thats how i did it, and it doesnt work...Do You know better?
Tim Rittel
275
Tim Rittel  
Fernando Carreiro:

Your sample code will not even compile because of the extra comma after the "Apple=1", so show your real code:

enum SelectBreakevenCorePlatzhalter

  {

   LnWCorePlatzhalter,    // profitable&nonprofitable Trades

   oWCorePlatzhalter,     // only profitable Trades

   oLCorePlatzhalter,     // only nonprofitable Trades

  };

input SelectBreakevenCorePlatzhalter BreakevenCorePlatzhalter=LnWCorePlatzhalter; // which Trades to Trail?



      if(StartProfit77CorePlatzhalterBuy>RAM_Order77_CorePlatzhalter_Buy&&                                BreakevenCorePlatzhalter==oWCorePlatzhalter) 

      {RAM_Order77_CorePlatzhalter_Buy=KeinBuyStopLoss;}



      if(StartProfit77CorePlatzhalterBuy<RAM_Order77_CorePlatzhalter_Buy&&                                 BreakevenCorePlatzhalter==oLCorePlatzhalter) 

      {RAM_Order77_CorePlatzhalter_Buy=KeinBuyStopLoss;}

// Problem1 above

//+------------------------------------------------------------------+

// pProblem2 below

enum SelectHowToCorePlatzhalter

  {

   VnHCorePlatzhalter,    // Virtual&Hard Stoplosses

   oVCorePlatzhalter,     // only Virtual Stoploss 

   oHCorePlatzhalter,     // only Hard Stoploss

  };

input  SelectHowToCorePlatzhalter HowToCorePlatzhalter=VnHCorePlatzhalter;        // how to use CorePlatzhalter?



      if((GlobalVariableGet(SYmbol+" "+PEriod+" TrailOS "+DoubleToString(OrderOpenPrice(),_Digits)+" Order77 CorePlatzhalter TrailingStop Sell")-ASK)/Point>=STOPLEVEL&&  HowToCorePlatzhalter==(VnHCorePlatzhalter||oHCorePlatzhalter)   

&&GlobalVariableGet(SYmbol+" "+PEriod+" TrailOS "+DoubleToString(OrderOpenPrice(),_Digits)+" Order77 CorePlatzhalter TrailingStop Sell")!=KeinSellStopLoss)
Fernando Carreiro
5000
Fernando Carreiro  
Tim Rittel:

Did you even try to compile that? It will give compile errors! You did not even bother to fix it first - as I said, the extra comma:

enum SelectBreakevenCorePlatzhalter
  {
   LnWCorePlatzhalter,    // profitable&nonprofitable Trades
   oWCorePlatzhalter,     // only profitable Trades
   oLCorePlatzhalter    // only nonprofitable Trades
  };

enum SelectHowToCorePlatzhalter
  {
   VnHCorePlatzhalter,    // Virtual&Hard Stoplosses
   oVCorePlatzhalter,     // only Virtual Stoploss 
   oHCorePlatzhalter    // only Hard Stoploss
  };
Tim Rittel
275
Tim Rittel  
Fernando Carreiro:

Did you even try to compile that? It will give compile errors! You did not even bother to fix it first - as I said, the extra comma:

Thank You very much for the hint with the comma, there must be still another mistake...

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
enum SelectHowToCorePlatzhalter
  {
   VnHCorePlatzhalter=0,
   oVCorePlatzhalter=1,
   oHCorePlatzhalter=2 
  };
input  SelectHowToCorePlatzhalter HowToCorePlatzhalter=VnHCorePlatzhalter;

if(HowToCorePlatzhalter==(VnHCorePlatzhalter||oVCorePlatzhalter))
{}

Problem1 above, Problem2 below, it compiles, but doent work charmingly..
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
enum SelectBreakevenCorePlatzhalter
  {
   LnWCorePlatzhalter=0,
   oWCorePlatzhalter=1, 
   oLCorePlatzhalter=2 
  };
input SelectBreakevenCorePlatzhalter BreakevenCorePlatzhalter=LnWCorePlatzhalter;

if(BreakevenCorePlatzhalter==oWCorePlatzhalter)
{}
if(BreakevenCorePlatzhalter==oLCorePlatzhalter)
{}
i fixed it afterwards, but wanted to response as fast as possible..sorry
Fernando Carreiro
5000
Fernando Carreiro  
Tim Rittel:

Thank You very much for the hint with the comma, there must be still another mistake...

i fixed it afterwards, but wanted to response as fast as possible..sorry

"||" is a Boolean operator so it should be used as follows:

if( ( HowToCorePlatzhalter == VnHCorePlatzhalter ) || ( HowToCorePlatzhalter == oVCorePlatzhalter ) )

As for part 2, if you set the default to "LnWCorePlatzhalter" then obviously the two tests will give false and will never be used!

Consider using a switch statement instead of multiple if statements.

Tim Rittel
275
Tim Rittel  
Fernando Carreiro:

"||" is a Boolean operator so it should be used as follows:

As for part 2, if you set the default to "LnWCorePlatzhalter" then obviously the two tests will give false and will never be used!

THAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnk You Fernando, :-) ;-) so glad you asked me for the real code.....Thank You, wow, another nut is cracked...thanks

To add comments, please log in or register