adventures of a newbie - page 6

 
cloudbreaker:

No worries. With only a few amendments, it should actually do the job for you.

You should start by amending the TakeProfit "error" I built in for you. Have a look at how the StopLoss is done for a clue.

Once you've got it working, I hope you'll start adding in error handling, and some operator-friendly stuff like Print() statements so you can see easily in the logs what it is doing.

Pseudo code is important before committing to code (even for seasoned programmers), but don't overcook it.

You seem to attract help due to your good-natured manner. My guess is that you either work in HR or are interested in human psychology?


CB

Hey CB,


It is nice that someone said I have a good natured manner. I am a psychologist by background, 2 degrees with an emphasis on personality assessment and development and positive psychology. I have done a lot of work with HR and training managers on how to make their staff enjoy work more (which ultimately results in a higher bottom line and higher creativity).


You guys are wonderful here. I am amazed at good human nature, and will repay the deed and help you provide me thousand fold when the time comes. ('Pay It Forward' - watch the film if you haven't seen it ;)

 

Hey Tim,


I figured out the array thing you set me to do (I think). The code is below, is that correct. I'm posting it here even though I included the EA so other's who will be looking for similar info can see quickly what's up.


string Pair[] = {"EURUSD","GBPUSD","USDJPY","USDCHF","AUDUSD"}; //***Global Declaration of Array 'Pair' so we can call it in 'start' function   


int count = ArraySize(Pair);                //computer doesn't know how many elements array has, this is necessary to set the value for 'for' loop
for (int c=0;c<count;c++)                   //loop started to go through each element of the Array. After this I don't know how to use this, i guess we substitute OrderSend(Symbol) part with the array name so it loops through that. is that so?
    


ps: by the way my mq4 files don't all show up in the mt4>experts folder, I have about 30 experts but only about 5 show up there if I go into the folder through windows or try to attach anything to here (but all show up through mt4). any idea why? (that's why i posted .txt)

Files:
 

Hi Nick,


Well done!


I'm now going to raise the bar a bit and suggest that you now have a go at writting the code for the EntryRules function plus a bit of other stuff that you will need to effectively call this function.


I have added quite a few comments, thoughts ideas and suggestions to the code for you to have a look at. I have also marked the TODO areas for you to work on. See what you can do with this and post it back on the forum when you are ready. If you get overwhelmed, just post back what you have done. I can break it down into smaller chunks of work if necessary.


A couple of possibilities regarding your missing mq4 files. Could you have the file attributes set to hidden? MetaTrader seems to let me edit hidden files if I go through the modify command on the navigator panel. Another possibility is that the files are in another folder such as the indicators folder. Perhaps you could try a windows search for all mq4 files in all the metatrader sub directories and include all hidden files (use the advanced options button for winXP) in your search.


Regards

Tim

.

Files:
 

If you are using Vista, and have UAC (User Account Control) turned on, then check here for your missing files:

C:\Users\<your account name>\AppData\Local\VirtualStore\Program Files\<MT4 install directory>\experts

 
cloudbreaker:

If you are using Vista, and have UAC (User Account Control) turned on, then check here for your missing files:

C:\Users\<your account name>\AppData\Local\VirtualStore\Program Files\<MT4 install directory>\experts

Thanks CB, I found it. Created a shortcut for fast access.

 

Hey Tim,


Ouf, it's 1am here in UK,I'm exhausted, gotta go to work in the morning. I been working on the code as per your suggestions. There are still many things unknown, but it's progressing well. I got as far as I could without your further help.


I cut out a lot of comments in the code to make it visually easier to manipulate (i pasted them at the end for my future reference), and also created a section at the end to show you what I did and in what order, also to ask you question there, etc. Like an 'ACtivity Log'. If you write in that log then it would be easier for me to work through the code, logically, psychologically and sequentially as well.


I shall await your feedback!

Nick

Files:
 
niko wrote >>

Hey Tim,

Ouf, it's 1am here in UK,I'm exhausted, gotta go to work in the morning. I been working on the code as per your suggestions. There are still many things unknown, but it's progressing well. I got as far as I could without your further help.

I cut out a lot of comments in the code to make it visually easier to manipulate (i pasted them at the end for my future reference), and also created a section at the end to show you what I did and in what order, also to ask you question there, etc. Like an 'ACtivity Log'. If you write in that log then it would be easier for me to work through the code, logically, psychologically and sequentially as well.

I shall await your feedback!

Nick

Hi Nick,


Sorry to be working you so hard.

You seem to be making progress. Once you grasp the concept of arrays and functions I think a lot of the fog will lift.

I suggest you just focus on trying to finish the EntryRules function and its call from the (main) start function. I think we are nearly there.

Tidying up old comments questions etc in the code is a good move.

Take it easy, your making good progress.

Will hear from you soon


Regards

Tim

Files:
 

Hey Tim,

haha, it's okay. Ideally I want to get to the debugging stage before I go for holiday this Wednesday night (for 8 days, Turkey,Izmere - at last a holiday!). I'm at work at the moment, but will resume the coding during lunch time and as soon as I get home. So will have it with you this evening!

Thanks for all your help Tim!

nick,,

 

Hey Tim,


I did the bit's you asked me to do for the code. Thank you for providing detailed answers to my questions and for writing a lot of comments throughout the code to help me get my head around this. I am starting to see how things patch together, how to use arrays properly and call specific functions (and the role of global and local variables).


I attached the latest version of our code.


One question, is there any reason why we didn't make EntryRules function to contain everything (including flags) to give us a buy/short condition, but instead we call upon it with flags later on to make the entry decision?

 

To CB:


Hey high flyer! I did all I could with Tim's tasks and thus decided to start looking at your code in more detail.


I went through your code, trying to understand and fix the errors in it. I managed to reduce the errors to just 'unbalanced parenthesis' for string fnGenerateSignal(). I don't know why it says unbalance in this case.


As always I would appreciate your thoughts on my progress with your code! Bear in mind there are still a lot of bits and bobs I don't understand, even the very basic stuff.

Files:
Reason: