Gday Mark 2

Post Reply
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: Gday Mark 2

Post by fx800 »

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
Lifesys
Trader
Posts: 126
Joined: Wed Apr 25, 2012 2:05 am
Location: Echuca Victoria. Australia

Re: Gday Mark 2

Post by Lifesys »

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!)
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: Gday Mark 2

Post by fx800 »

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
Lifesys
Trader
Posts: 126
Joined: Wed Apr 25, 2012 2:05 am
Location: Echuca Victoria. Australia

Re: Gday Mark 2

Post by Lifesys »

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.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: Gday Mark 2

Post by fx800 »

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
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Re: Gday Mark 2

Post by theforexedge »

Steve

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

Thanks, JP
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: Gday Mark 2

Post by fx800 »

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
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Gday Mark 2

Post by SteveHopwood »

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
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: Gday Mark 2

Post by fx800 »

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
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: Gday Mark 2

Post by fx800 »

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
Post Reply

Return to “Automated trading systems”