adventures of a newbie - page 2

 
cloudbreaker:

In answer to your question, I normally work as a chopper pilot. However, given the economic situation, the company I work for do not want to fly at the moment. So, in the interim, I've been developing EAs for a company which is owned by my best mate. We are live trading on behalf of some fairly well known funds.

I'm pleased that you are trying to learn to code and will help when ever I can. Its refreshing to find someone join the forum and want to learn to be self-sufficient.

Hey cloudbreaker. Wow, so I am in good hands in this forum!


My dream is to also run a fund, but donate a large proportion of the profits onto consciousness research and other positive projects. This is why I must learn mql.


Flying choppers - man thats awsome!!!

 

Niko


Unbalanced brackets and braces in the wrong place can be a problem. On thing that's helped me eliminate/find those kinds of errors is to use a text editor that is C++ friendly.


I create all my code in the Notepad++ text editor (freeware at Download.com). It has special features that highlight matching parentheses, matching braces etc, and does other color highlighting of text to help you keep your code organized. (be sure to select "C++" from the drop down menu under "Language")


I solved your problem by pasting your code into Notpad++ and found the misplaced bracket that was preventing your BUY code from working.


Cheers

 
FXtrader2008:

Niko


Unbalanced brackets and brackets in the wrong place can be a problem. On thing that's helped me eliminate/find those kinds of errors is to use a text editor that is C++ friendly.


I create all my code in the Notepad++ text editor (freeware at Download.com). It has special features that highlight matching parentheses, matching braces etc, and does other color highlighting of text to help you keep your code organized. (be sure to select "C++" from the drop down menu under "Language")


I solved your problem by pasting your code into Notpad++ and found the misplaced bracket that was preventing your BUY code from working.


Cheers




Hey fxtrader! You have come right on time as I have just spent an hour trying to figure out the whole misplaced bracket thing. I'l download the notepad++. The big issue at the moment for me is to figure out how to make the two code chunks run in parallel, i played around with if(OrdersTotal()==0) (made it ==0 || 1, haha which had a funny result, but that didn't solve the problem). No worries, don't give me the answer yet, I'l try and figure it out myself :)


do you trade for yourself, or are you more into programming?

 
cloudbreaker:

In answer to your question, I normally work as a chopper pilot. However, given the economic situation, the company I work for do not want to fly at the moment. So, in the interim, I've been developing EAs for a company which is owned by my best mate. We are live trading on behalf of some fairly well known funds.

I'm pleased that you are trying to learn to code and will help when ever I can. Its refreshing to find someone join the forum and want to learn to be self-sufficient.

No wonder your nick name is cloudbreaker, you are actually a pilot. I thought you are a programmer and the nick name has somthing to do with the most buzz of 2009 - cloud computing. :)

 
FXtrader2008:

Niko


Unbalanced brackets and brackets in the wrong place can be a problem. On thing that's helped me eliminate/find those kinds of errors is to use a text editor that is C++ friendly.


I create all my code in the Notepad++ text editor (freeware at Download.com). It has special features that highlight matching parentheses, matching braces etc, and does other color highlighting of text to help you keep your code organized. (be sure to select "C++" from the drop down menu under "Language")


I solved your problem by pasting your code into Notpad++ and found the misplaced bracket that was preventing your BUY code from working.


Cheers




Anyone else who needs a syntactic editor but who uses an Apple Mac, then I can recommend Smultron. Just hovering the cursor over a curly bracket will highlight its mate for you.

 
niko:

Hey fxtrader! You have come right on time as I have just spent an hour trying to figure out the whole misplaced bracket thing. I'l download the notepad++. The big issue at the moment for me is to figure out how to make the two code chunks run in parallel, i played around with if(OrdersTotal()==0) (made it ==0 || 1, haha which had a funny result, but that didn't solve the problem). No worries, don't give me the answer yet, I'l try and figure it out myself :)


do you trade for yourself, or are you more into programming?

You're barking up the wrong tree to try to make the code chunks run in parallel.

From memory of your particular issue, I think what you needed to do was to loop through all open orders and make a count into your own variables of how many of each type (buy & sell) you have, then base your conditional statements upon the result. In that case you will use OrdersTotal() only as a loop index.

 
cloudbreaker:

You're barking up the wrong tree to try to make the code chunks run in parallel.

From memory of your particular issue, I think what you needed to do was to loop through all open orders and make a count into your own variables of how many of each type (buy & sell) you have, then base your conditional statements upon the result. In that case you will use OrdersTotal() only as a loop index.

Nico, if this is the post you found a bit cryptic, please let me know and I'll try to explain further.

There are two separate lists - one with current orders and the other with orders that have been closed.

If you need to know how many current orders there are of a particular type, then you need to select each order in the current orders list, find out what type of order it is, increment the appropriate counter and move to the next order.

Hope this helps.


CB

 
cloudbreaker:

Nico, if this is the post you found a bit cryptic, please let me know and I'll try to explain further.

There are two separate lists - one with current orders and the other with orders that have been closed.

If you need to know how many current orders there are of a particular type, then you need to select each order in the current orders list, find out what type of order it is, increment the appropriate counter and move to the next order.

Hope this helps.


CB

Hello Blue Thunder!


Yep. I am having a think now how to organise my learning better, so it goes faster, as I feel like a brick who wants to learn how to fly....hmmmm....


I think 2 things are essential:

1. I will go again through the codeguru tutorials, tonight is a good night for this (also are there any other learning material you can recommend?)

2. I will need a lot of help from you and other coders on the smallest points in coding (even silly things like why does () have to come after 'return' and things like that. I have been apprehensive with this as I thought I would annoy you guys with these questions, but if you give me 'go ahead' then I will start asking for real and will progress faster! Then this thread can turn into a learning journey for other newbies as well.


So what do you say?

By the way, have you got your own helicopter? I saw one on ebay a few months ago for $800k, very nice one, some entrepreneur was selling it. I wanna buy one some time in the future :)

 
niko:

Hello Blue Thunder!


Yep. I am having a think now how to organise my learning better, so it goes faster, as I feel like a brick who wants to learn how to fly....hmmmm....


I think 2 things are essential:

1. I will go again through the codeguru tutorials, tonight is a good night for this (also are there any other learning material you can recommend?)

2. I will need a lot of help from you and other coders on the smallest points in coding (even silly things like why does () have to come after 'return' and things like that. I have been apprehensive with this as I thought I would annoy you guys with these questions, but if you give me 'go ahead' then I will start asking for real and will progress faster! Then this thread can turn into a learning journey for other newbies as well.


So what do you say?

By the way, have you got your own helicopter? I saw one on ebay a few months ago for $800k, very nice one, some entrepreneur was selling it. I wanna buy one some time in the future :)

The brackets are required because "return()" is a function in itself and, just like other functions it has an input parameter. In this case the purpose of the return function is to exit the current function to the point in the logic from where the current function was called. And the input parameter within the brackets is the value to be transported back to the calling logic. So let's say you have your own function, the purpose of your function being to return the number of buy orders you have back into some logic in the start() function where you called it from.

In that case you'll declare your function as an int (because it returns an integer) like this:

int MyBuyOrderCounter()

Within that function, once you've worked out the number of buy orders (x) you will call the return() function as follows:

return(x);

And the logic which calls your function from within the start() function may look like this:

int NumberOfBuyOrders = MyBuyOrderCounter();


Thankfully, I don't own my own aircraft, but have been working as a commercial pilot in an EC 155.


CB

 
cloudbreaker:

The brackets are required because "return()" is a function in itself and, just like other functions it has an input parameter. In this case the purpose of the return function is to exit the current function to the point in the logic from where the current function was called. And the input parameter within the brackets is the value to be transported back to the calling logic. So let's say you have your own function, the purpose of your function being to return the number of buy orders you have back into some logic in the start() function where you called it from.

In that case you'll declare your function as an int (because it returns an integer) like this:

int MyBuyOrderCounter()

Within that function, once you've worked out the number of buy orders (x) you will call the return() function as follows:

return(x);

And the logic which calls your function from within the start() function may look like this:

int NumberOfBuyOrders = MyBuyOrderCounter();


Thankfully, I don't own my own aircraft, but have been working as a commercial pilot in an EC 155.


CB



Thank you cloudbreaker! This is starting to make a bit more fun, I didn't know that you can call a function within a return (even though it's probably in the mql book, just like everything else theoretical). Nice looking helicopter EC 155! Why 'thankfully', you don't want your own chopper?