stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

First programming forever.
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1467
Page 1 of 1
Author:  sat79 [ Fri Feb 08, 2013 9:11 am ]
Post subject:  First programming forever.

I'm making my first script and learning how to program things my self. Can somebody give me example how I can do some comparing. I want to use different buffers with different size signals. Example. if signal is 50 pips or less I want to use buffer what is 10% of signal, if signal is 60 pips or less I want to use buffer what is 9% of signal, 70 pips or less 8% etc.
So how to do?
My script should be able to send pending orders some day. :D
And for sure there will be many many questions more.
Gratefull for any help.
Author:  sat79 [ Fri Feb 08, 2013 9:21 am ]
Post subject:  Re: First programming forever.

Little bit more explanation.
I want to make list like this...
If size<=50pips use 10% buffer
If size<=60pips use 9% buffer
If size<=70pips use 8% buffer.
Etc...
Author:  sat79 [ Mon Feb 11, 2013 4:28 pm ]
Post subject:  Re: First programming forever.

Hmm... Maybe nobody knows answer to my question... :shock: But here is next one... And This is what I have done allready. Littlebit code still missing but thats later. I have digit problem. Example in yen pairs digits okay when print PA prices in expert tab. but then example in EU I get printed only 4 digits... Other calculations are allso still in "study" phase, but I have try to get this digit problem solved first. Please, somebody, push me in right direction. I have allready try to study steves code and google and... So how I can get (ihighhest)+digits together?
And when (if) you look code, if you have some notes to give, please do so. I really want to learn this s**t. And is good if you can use "Me Tarzan You Jane" language ;)
Author:  mjws00 [ Tue Feb 12, 2013 5:07 am ]
Post subject:  Re: First programming forever.

sat79,

You may have to do a little more explaining of what you intend. "if size" and "use 10% buffer" don't mean anything in their normal sense.

Looks like you are trying to get the range (high-low) of a set of bars, then use that to choose a constant to calculate a stop.

"buffers" are what we use when we write indicators... in Empty4 typically an array. So the language is confusing. Use variable names that are meaningful.

You have braces {} all over the place that are unnecessary. Read Gary or Baluda's code for good structure or formatting. Paul writes very easy to read code. http://www.stevehopwoodforex.com/phpBB3 ... f=45&t=629

You have declared Buffer as an int then assign it a double (decimal) value.

Maybe a bump will help you get another pair of eyes.... I'm sure there is a language barrier. I'd love to help more, but it is brutal code to read. Clean well commented code is how we survive.

Keep at it,

Mike
Author:  mjws00 [ Tue Feb 12, 2013 6:15 am ]
Post subject:  Re: First programming forever.

I tried to clean your file up a bit.... and commented some on it.

Take it as some positive suggestions on building good habits. Not intended to bring you down. We all start somewhere.

Good Luck,

Mike
Author:  sat79 [ Tue Feb 12, 2013 10:46 am ]
Post subject:  Re: First programming forever.

Thanks for your responce Mike. As I say in my post earlier "feel free to comment". I will take every comment in positive way. And like allso sayd before, this is first try to do some kind of program ever (no c or c++ or nothing before). So for total newbie with some sort of language issue (reading coders guru's doguments with google translater) start seems to be hard.. :lol: But I hope that I will gasp this some day. I will look your cleaning and take some notes from that.

Then some extra explanations what I try to do. I attac picture for make it more clean (hopefully).
I trade pins and engulfing bars etc. When I go short I want to go short few pips (buffer) below signal candle and when go long I want to add spread and that "buffer" to my entry price.
Reason why that buffer cannot be just example 5 pips is that signals are so different size. Some pairs I can get 4H signal what is 30 pips and then USDZAR 4H signal can easily be 1000 pips. Thats why I need to use different amount of pips of different size of signals.
Hope this makes more clear what I try to do...
Author:  sat79 [ Tue Feb 12, 2013 1:54 pm ]
Post subject:  Re: First programming forever.

Actually that Mikes commentary in his cleaned code was very educating for me.
Now I'm cleaning and commenting my code and try to test it part by part for get it working correctly. What I still havn't get is that digit issue. This time code is only printing info in expert tab/log. It works with pairs what have 2-4 decimals. What can cause that??? Or is it feature of that expert tab/log that it prints only 4 decimal?
Author:  sat79 [ Tue Feb 12, 2013 3:53 pm ]
Post subject:  Re: First programming forever.

Okay... After some testing it seems to be only experts tab/log feature.
Author:  sat79 [ Thu Feb 14, 2013 7:47 pm ]
Post subject:  Re: First programming forever.

Okay So here we go again. It works... Please take a look to code and give your opinion what you would do different. And what can be done different. And Allso if know what causes error 130 when open more than 1 position, I will be all ears. :D
I will attach "short" version of this script in some day.
If you use this script and find some bug(s) Please let me know of them.
But if I were you I would NOT use this script in my live account yet. :lol:
Author:  sat79 [ Thu Feb 14, 2013 9:25 pm ]
Post subject:  Re: First programming forever.

Okay that error bug is solved... In my logig to change orders from Stop to limit was something wrong. Must be some kind of brain fart... So I desided to delete all limit order systems and it start working correctly (hope so).
But still... Comments welcome.
Here is atached final versions.
All times are UTC Page 1 of 1