adventures of a newbie - page 9

 

Tim,


I got the code to point where there are no errors reported when it is compiled (it was just fixing a few bugs you highlighted), even though in strategy tester it does not make any trades yet. But I am puzzled at something:


int EntryRules(string CurrencySymbol, double TopFilter, double BottomFilter)  //Tim: string CurrencySymbol not CurrencySym right?
{

      emas_Up =  (ema7>ema14) && (ema14>sma50);
      if (emas_Up && Ask < TopFilter) // Note the TopFilter value  is a parameter passed to the function just like CurrencySymbol. These have not been defined anywhere as global variables.
         result = LONG_ENTRY;   // We have assigned the manifest constant to the local variable result 



The parameters TopFilter and BottomFilter. Do you mean 'TopFilters' and 'BotFilters' parameters instead? (these are the ones we defined as variables on global level. The ones below. I changed the code to reflect this, and it produced no errors (this meant changing debug statement accordingly). What's your guru take on this?

   double TopFilters[NUM_CURRENCY_PAIRS];     // So we just define uninitialised arrays of the required size
   double BotFilters[NUM_CURRENCY_PAIRS];    // This is Step 1/2 for array building. Step 2/2 is to assign a numerical value to each element, 
 
niko:

Hey CB, The ideal is to have a multi-pair EA - which is what Tim and I are trying to build. However, a single-pair EA is also highly desirable as it is teaching me how to code. Your coding styles differ and it is an excellent exercise for me to see how the same/similar idea can be coded differently. Plus, I thought if we finished the single EA first then I'd use that to help me manual trade, but it looks as though both codes will be finished round the same time now

I'm not sure exactly what you mean by single and multi. How do they relate to the model I described above? ie. A single EA which could be dropped on to any pair and would trade just on the pair of the chart it was dropped onto - making all trading decisions based just upon the pair of the chart it was dropped onto (a single codebase to maintain). Just trying to get the terminology straight so I know what you want.


CB

 

Hey CB,

In my vague understand how the EA's are executed, what I meant was 1. 1 EA that can be run and that will trade multiple pairs at once. 2. A single EA that needs to be dropped onto a specific chart and would thus apply to that chart ONLY (the question is, is it possible to make a single EA that can be dropped on let's say 3 different charts and would still work on those 3 charts? I tried this before but for some reason only 1 chart was executed (all the other ones did not run).

 
niko:

Hey CB,

In my vague understand how the EA's are executed, what I meant was 1. 1 EA that can be run and that will trade multiple pairs at once. 2. A single EA that needs to be dropped onto a specific chart and would thus apply to that chart ONLY (the question is, is it possible to make a single EA that can be dropped on let's say 3 different charts and would still work on those 3 charts? I tried this before but for some reason only 1 chart was executed (all the other ones did not run).

Yes, its easily possible. One of my EAs:

- Can be dropped onto multiple different charts (which are running concurrently in the same platform instance or which are each running on a separate platform instance - whatever you choose)

- Will make its decisions only based upon the pair associated with the chart it is running on

- Will trade just for the pair associated with that chart


CB

 

Thank you CB, I didn't know that. I'm gonna spend more time this week comparing the 2 codes, in fact i printed off both of them and will post them all over my room to try and understand better what's going on. understanding the logical reasoning behind the coding is probably the hardest thing I'm faced with at the moment.

 
niko:

Thank you CB, I didn't know that. I'm gonna spend more time this week comparing the 2 codes, in fact i printed off both of them and will post them all over my room to try and understand better what's going on. understanding the logical reasoning behind the coding is probably the hardest thing I'm faced with at the moment.

Ok, if you come across something you don't understand in the code I left you, just ask away.


CB.

 
Thank you CB. Will definintely do! I'm going through it right now
 

CB, need your wisdom. I can't seem to figure out the errors in the compiler (and it's the same ones i encountered before and didn't know what to do). In order of errors. could you share some light per error so I know what to do next time.


1. Description: " 'for' - semicolon expected." My understanding something is up with our brackets somewhere, as this line does not need ;.

for (int c=0;c<NUM_CURRENCY_PAIRS;c++) 


2. description: " 'c' -expression on global scope not allowed'. Same line as above. I don't get this, how can they not allow a global variable declaration? Plus many people use this code and it works fine.

3. description "NUM_CURRENCY_PAIRS" - expression on global scope not allowed". But I already declared this next to externals, so it can't get any more global than that!

4. description : "{ expression on global scope not allowed. It seemed not to like the brackets for the below code.

{
   sSignal = fnGenerateSignal();						// change this to "sGignal = fnGenerateSignal();" ***done
   if (fnShouldWeTrade())
    fnTrade();                                                            // change this to "fnTrade();"**done
   return(0);
   }


thank you,

nick

 
niko:

CB, need your wisdom. I can't seem to figure out the errors in the compiler (and it's the same ones i encountered before and didn't know what to do). In order of errors. could you share some light per error so I know what to do next time.


1. Description: " 'for' - semicolon expected." My understanding something is up with our brackets somewhere, as this line does not need ;.


2. description: " 'c' -expression on global scope not allowed'. Same line as above. I don't get this, how can they not allow a global variable declaration? Plus many people use this code and it works fine.

3. description "NUM_CURRENCY_PAIRS" - expression on global scope not allowed". But I already declared this next to externals, so it can't get any more global than that!

4. description : "{ expression on global scope not allowed. It seemed not to like the brackets for the below code.


thank you,

nick

Can you post the entirety of the code you are trying to compile please. Ta.


CB

 
Your wish is my command (i was gonna say 'high flyer' but then checked dictionary online and apparently its a rude comment, nevermind)
Reason: