| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Gday Mark 2 https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=917 |
Page 22 of 30 |
| Author: | VirtualFM [ Wed Feb 27, 2013 12:57 am ] |
| Post subject: | Re: Gday Mark 2 |
Those are great moments! Keep thinking! |
|
| Author: | fx800 [ Fri Mar 01, 2013 9:44 pm ] |
| Post subject: | Re: Gday Mark 2 |
Hi Steve, For your Gday MK 2 EA, I would like to try using a pending order to buy when a candle cross above the stoch 20, xxx pips above the high of the candle that crosses the stoch 20 + spread. Is it correct to use the following code //Long if (SendLong) { type = OP_BUYSTOP; if (!BuyOpen) { price = High[1] + (BufferPips / factor) + (spread / factor); }//if (!BuyOpen) }//if (SendLong) and for sell //Short if (SendShort) { type = OP_SELLSTOP; if (!SellOpen) { price = Low[1] - (BufferPips / factor) - (spread / factor); }//if (!SellOpen) }//if (SendShort) I have been testing this on demo, and found that the EA places a trade as soon as the stoch crosses the 20/80 line. Not sure why. Many thanks. peter |
|
| Author: | SteveHopwood [ Fri Mar 01, 2013 10:05 pm ] |
| Post subject: | Re: Gday Mark 2 |
A tip for you Peter. Next time you post code, enclose it within a Code: Select all Assuming that you have calculated double spread = (Ask - Bid) * factor then your code should work. Try it and see. Here is how code looks when enclosed within Code: Select all |
|
| Author: | fx800 [ Fri Mar 01, 2013 10:24 pm ] |
| Post subject: | Re: Gday Mark 2 |
Thank you very much, Steve. Sorry didn't know how to use "code : SELLECT ALL" before. This is how the code should look like. Code: Select all Code: Select all I thought Code: Select all I shall try the "double spread =(Ask - Bid)*factor " next week. Cheers, peter |
|
| Author: | SteveHopwood [ Fri Mar 01, 2013 10:41 pm ] |
| Post subject: | Re: Gday Mark 2 |
It depends what you want to do. I declare spread purely locally, in DisplayUserFeedback() and IsTradingAllowed() It may be easier to simply declare spread as a programme-wide variable and read it at the top of start(). I do what I do because I do what I do and it works for me, not because I have some glorious insight into the use of the spread. |
|
| Author: | fx800 [ Fri Mar 01, 2013 10:59 pm ] |
| Post subject: | Re: Gday Mark 2 |
I have put the "double spread" in the wrong place. I have now moved it to top of Start() as you suggested, like so Code: Select all |
|
| Author: | SteveHopwood [ Fri Mar 01, 2013 11:15 pm ] |
| Post subject: | Re: Gday Mark 2 |
You still have spread declared as a local variable. It cannot be used throughout your programme unless you pass it to functions as a parameter. Sorry, but I am tired now and have done the best I can to help. It is up to you to sort things out for yourself now. You will - I did when I started.
|
|
| Author: | fx800 [ Fri Mar 01, 2013 11:32 pm ] |
| Post subject: | Re: Gday Mark 2 |
Thank you, Steve. I am sure I will figure things out myself. Thanks for your help, and have a nice week end. peter |
|
| Author: | fx800 [ Sun Mar 03, 2013 11:48 am ] |
| Post subject: | Re: Gday Mark 2 |
I have solved the problem by adding/subtracting (Ask - Bid) from price, instead of having to declare double spread = (Ask - Bid) * factor again. Will see if this works tomorrow. peter |
|
| Author: | SteveHopwood [ Sun Mar 03, 2013 12:20 pm ] |
| Post subject: | Re: Gday Mark 2 |
That is a neat idea - I never thought of that. |
|
| All times are UTC | Page 22 of 30 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|