| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| how to add pips https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=475 |
Page 1 of 1 |
| Author: | unimak [ Fri Apr 06, 2012 5:29 pm ] |
| Post subject: | how to add pips |
i want to add 20 pips to my pivot , how do i do that , every time i try to put it is not taking extern int mytgt= 20 ; int pivot ; int tgt; tgt = (pivot + mytgt ); damn tgt says 20 where what i would like it to display is 1.3160 ( pv 1.3140 + 20 pips ) please help, i am at my wits end. |
|
| Author: | garyfritz [ Fri Apr 06, 2012 10:00 pm ] |
| Post subject: | Re: how to add pips |
It's doing exactly what you told it to do. An "int" is an INTEGER, and it holds an integer value. It can't hold fractional values like 1.3160. Furthermore you never set the pivot value to anything, so it has its default value of 0. tgt = (pivot + mytgt) = (0 + 20) = 20. For prices you need to use double variables. That's a different variable type that can hold fractional values. So you'd do something like: extern double mytgt = 0.0020; double pivot, tgt; pivot = 1.3160; tgt = (pivot + mytgt); If you want to use pips as your input (e.g. extern double mytgt = 20), you will have to divide by the proper scaling factor. For non-JPY pairs that's 10000, for JPY pairs it's 100. So 20 / 10000 = 0.0020. You're asking an incredibly basic question that suggests very little understanding of coding concepts. I recommend you go read some programming guides, e.g. the CodersGuru guide Steve posted here and/or http://book.mql4.com, to get a better understanding of what's going on. Understand the concepts before you jump in and try to write an EA. |
|
| Author: | unimak [ Sat Apr 07, 2012 6:53 am ] |
| Post subject: | Re: how to add pips |
many thanks, well i am not a coder , just wanted to try my hands on mql . since you have given me a link to codeguru , i shall go thru it . Many thanks for your help . |
|
| Author: | JulesvH [ Sat Apr 07, 2012 8:36 am ] |
| Post subject: | Re: how to add pips |
Well, jump in and just try can also be a way to learn it. But thanks for the links |
|
| Author: | garyfritz [ Sat Apr 07, 2012 4:08 pm ] |
| Post subject: | Re: how to add pips |
And more power to you! I meant no offense -- everybody's got to start somewhere. But you wouldn't go into a literary forum and ask "what are these square-ish things with the funny little marks on the paper, anyway?" You'd learn to read first so you wouldn't have to ask very basic questions. Read through the CodersGuru guide and work through some examples, and then you'll be able to ask much more confusing questions. |
|
| Author: | SteveHopwood [ Sat Apr 07, 2012 9:38 pm ] |
| Post subject: | Re: how to add pips |
To back Gary up just in case you are feeling slightly wounded, he really meant no offence. Gary was genuinely trying to point you in the right direction. unimak, really go for it. This is my forum. I have attracted to it some of the brightest minds in the Forex trading world, yet only a few years ago, I was reading the CodersGuru stuff and saying to myself, "Ummmmmm, errrrrr." I am no mega-brain. If I can learn to code then so can you. Have fun. I do. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|