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

Gday Mark 2
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=917
Page 23 of 30
Author:  fx800 [ Sun Mar 03, 2013 12:59 pm ]
Post subject:  Re: Gday Mark 2

SteveHopwood wrote:
fx8000 wrote:
fx8000 wrote:Thank you, Steve. I am sure I will figure things out myself.

Thanks for your help, and have a nice week end.

peter

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
That is a neat idea - I never thought of that.

:D
Thank you, Steve.

I will try it out tomorrow, and see if it works.

pete
Author:  Lifesys [ Tue Mar 05, 2013 11:26 am ]
Post subject:  Re: Gday Mark 2

Hi fx8000
Using (Ask - Bid) in those places is rather pointless.
Spread is not a Global variable, it might look fixed on a company list but is transient, changing continually.
spread = (Ask - Bid)*factor;
ALWAYS works when used with PFactor routine & in the correct place
ie just before a trade etc. otherwise before the value has meaning, you need a

Code: Select all

  RefreshRates(); // then
  spread  = (Ask-Bid )*factor;
or

Code: Select all

 RefreshRates();
 spread =(MarketInfo(symbol,MODE_ASK)-MarketInfo(symbol,MODE_BID))*PFactor(symbol);
for a multi EA.

If you are looking to enter on high of previous candle + buffer, then Code above is better as -

Code: Select all

   if (SendLong)
   {               
      type = OP_BUYSTOP;     
      if (!BuyOpen)
         price = High[1] + Ask - Bid + BufferPips / factor;
      if (!SendAlertNotTrade) 
 //etc
then it is immediate.
(curly brackets are only required if more than one statement follows - rule 213!)
Author:  fx800 [ Tue Mar 05, 2013 11:50 am ]
Post subject:  Re: Gday Mark 2

Lifesys wrote:Hi fx8000
Using (Ask - Bid) in those places is rather pointless.
Spread is not a Global variable, it might look fixed on a company list but is transient, changing continually.
spread = (Ask - Bid)*factor;
ALWAYS works when used with PFactor routine & in the correct place
ie just before a trade etc. otherwise before the value has meaning, you need a

Code: Select all

  RefreshRates(); // then
  spread  = (Ask-Bid )*factor;
or

Code: Select all

 RefreshRates();
 spread =(MarketInfo(symbol,MODE_ASK)-MarketInfo(symbol,MODE_BID))*PFactor(symbol);
for a multi EA.
Hi Lifesys,

Thank you very much for your advice.

Where do I place the code you have mentioned ?

Do I place the code under "void LookForTradingOpportunities()" which is where the trades are taking place.

Do I have to declare "spread" as a double, otherwise I get the error message 'spread' - variable not defined. I think we need to declare "spread" as a double to conitnually calculate spread.


peter
Author:  Lifesys [ Tue Mar 05, 2013 2:21 pm ]
Post subject:  Re: Gday Mark 2

Hi
Your code

Code: Select all

price = High[1] + (BufferPips) + (spread/factor) 
is all wrong.

High[1] is a price
Ask-Bid is the current spread in price
BufferPips is NOT a price so it requires divide by the factor to represent a price value.

Correct is what I added above for OP_BUYSTOP

Code: Select all

price = High[1] + (Ask - Bid) + BufferPips / factor;
eg
price = 1.0250 + (1.0220 - 1.0218) + 5 / 10000 = 1.0257
(Ask - Bid) IS the spread in real current price terms.
Only use (Ask-Bid) * factor; if you need to display the spread in pips for some reason.
Author:  fx800 [ Tue Mar 05, 2013 2:44 pm ]
Post subject:  Re: Gday Mark 2

Lifesys wrote:Hi
Your code

Code: Select all

price = High[1] + (BufferPips) + (spread/factor) 
is all wrong.

High[1] is a price
Ask-Bid is the current spread in price
BufferPips is NOT a price so it requires divide by the factor to represent a price value.

Correct is what I added above for OP_BUYSTOP

Code: Select all

price = High[1] + (Ask - Bid) + BufferPips / factor;
eg
price = 1.0250 + (1.0220 - 1.0218) + 5 / 10000 = 1.0257
(Ask - Bid) IS the spread in real current price terms.
Only use (Ask-Bid) * factor; if you need to display the spread in pips for some reason.
Thank you for your help again.

If you look at my post above, you will notice I did divide BufferPips by factor to get the correct decimals. The code came from Steve's pending order script which he very kindly wrote for Phillip located under SCRIPTS.

My original mistake is failing to muliply the double spread = (Ask - Bid) by factor and not knowing where to declare the double spread.

However, I take notice that there is actually no need to convert spread into the correct decimals, just use (Ask - Bid) as you suggested.

Thanks again for your help and thank you for the PFactor codes.

Peter
Author:  theforexedge [ Fri Mar 08, 2013 6:38 pm ]
Post subject:  Re: Gday Mark 2

Steve

Is it possible to add trading days / time into Gday at some point?

Thanks, JP
Author:  fx800 [ Sat Apr 06, 2013 3:09 pm ]
Post subject:  Re: Gday Mark 2

Steve,

Your ea is ideally suited to catch any pullback in the yen pairs next week. Just set to trade long only, lower time frame H1 or M30.

Useful for those who work full time and is not able to trade manually real time.

peter
Author:  SteveHopwood [ Sat Apr 06, 2013 5:08 pm ]
Post subject:  Re: Gday Mark 2

fx8000 wrote:Steve,

Your ea is ideally suited to catch any pullback in the yen pairs next week. Just set to trade long only, lower time frame H1 or M30.

Useful for those who work full time and is not able to trade manually real time.

peter
What a clever idea.

:D
Author:  fx800 [ Sat Apr 06, 2013 5:25 pm ]
Post subject:  Re: Gday Mark 2

SteveHopwood wrote:
fx8000 wrote:Steve,

Your ea is ideally suited to catch any pullback in the yen pairs next week. Just set to trade long only, lower time frame H1 or M30.

Useful for those who work full time and is not able to trade manually real time.

peter
What a clever idea.

:D
I am glad you approve. If there are any pullbacks, your ea should gather the green pips.

peter
Author:  fx800 [ Sun Apr 07, 2013 9:04 pm ]
Post subject:  Re: Gday Mark 2

I sincerely hope that Bob is right that the move up north of xxxjpy still has some legs.

If you look at the charts, the yen has already weaken substantially since KURODA was nominated as the next governor of the BOJ some months ago.

I hope we are trading sensibly and not put all our eggs in one basket.

Good luck to you all this coming week.

peter
All times are UTC Page 23 of 30