My shell EA code

Post Reply
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: My shell EA code

Post by SteveHopwood »

Latest update in post 1.

Faults have come to light as I have used the shell, that I had to correct in the EA I was coding. I have then returned to the shell and reproduced the corrections.

I have removed the OverallTrend variable from the trend-detection functions as I have never used it.

: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.
4exbob
Posts: 8
Joined: Wed Mar 07, 2012 10:05 pm

Re: My shell EA code

Post by 4exbob »

another waisted day, well not totally... was out and the sun was shining :-)

but started this morning some test (symphony and other on a crimmy)
back at home, hmmm no trades
yes, once again lot size to high or ....
bang the head (i am also an I....)

well some criminals are more equal then others.
in this case mbtrading uk
and the lotsize by mbtrading is 10.000,
so 1 full mbtrading lot is really a mini

maybe you can in another life, when coding allowed lotsizes
take MarketInfo(Symbol() ,MODE_LOTSIZE)
into consideration

a little ps
in the symphony ea, initially MaxLotsAllowed is also 0 (on the trading chart), because
initially it is not calculated. It is only in a loop regarding open trades.
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: My shell EA code

Post by SteveHopwood »

4exbob wrote:another waisted day, well not totally... was out and the sun was shining :-)

but started this morning some test (symphony and other on a crimmy)
back at home, hmmm no trades
yes, once again lot size to high or ....
bang the head (i am also an I....)

well some criminals are more equal then others.
in this case mbtrading uk
and the lotsize by mbtrading is 10.000,
so 1 full mbtrading lot is really a mini

maybe you can in another life, when coding allowed lotsizes
take MarketInfo(Symbol() ,MODE_LOTSIZE)
into consideration

a little ps
in the symphony ea, initially MaxLotsAllowed is also 0 (on the trading chart), because
initially it is not calculated. It is only in a loop regarding open trades.
:D
What the blue blazes are you wittering about and why are you wittering about it here?

Don't answer. That was a rhetorical question intended to highlight that you are an idiot.

Maybe you are so thick that the point of this thread has escaped you. Go back to post one and work out what that is.

Do not waste my time again with moronic posts like your latest, or I will remove from you your ability to post at all.
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.
4exbob
Posts: 8
Joined: Wed Mar 07, 2012 10:05 pm

Re: My shell EA code

Post by 4exbob »

SteveHopwood wrote:
4exbob wrote:another waisted day, well not totally... was out and the sun was shining :-)

but started this morning some test (symphony and other on a crimmy)
back at home, hmmm no trades
yes, once again lot size to high or ....
bang the head (i am also an I....)

well some criminals are more equal then others.
in this case mbtrading uk
and the lotsize by mbtrading is 10.000,
so 1 full mbtrading lot is really a mini

maybe you can in another life, when coding allowed lotsizes
take MarketInfo(Symbol() ,MODE_LOTSIZE)
into consideration

a little ps
in the symphony ea, initially MaxLotsAllowed is also 0 (on the trading chart), because
initially it is not calculated. It is only in a loop regarding open trades.
:D
What the blue blazes are you wittering about and why are you wittering about it here?

Don't answer. That was a rhetorical question intended to highlight that you are an idiot.

Maybe you are so thick that the point of this thread has escaped you. Go back to post one and work out what that is.

Do not waste my time again with moronic posts like your latest, or I will remove from you your ability to post at all.
thanks Steve,

had no intention to derail this thread or take precious time from coders.

just wanted to make you and other coders aware of what i encountered.

noticed it with testing symphony, on a broker which has another dictionary
c.q. defenition of what we trade when we set lot=1.0

at 'normal' brokers this would mean a full lot , cq a contract size of 100.000 units

at mbtrading.co.uk lot=1.0 means a contract size of 10.000 units

result is that maxlotcalculation (ARS) is lower then expected. (factor 10)

as i see maxlotcalculation as part of moneymanagement, i presumed that would
make part from the shell which forms the basis for the EA's coded.

therefore i posted here. when you think it is not apropriate here, just move or delete.
it is your board.

can imagine you say , stay with 'normal' brokers. not in my lifetime i am going to change this
(why i wrote maybe in another life)
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: My shell EA code

Post by SteveHopwood »

Latest update in post 1. A few bloops have emerged as I used the shell; these are fixed.

I have added a 'bare bones' shell.

: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.
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: My shell EA code

Post by SteveHopwood »

Latest update to the full shell in post 1. Adding the Recovery module to an EA I am writing for faxxion, I noticed I had not included the code to adapt the Recovery pips inputs to x digit crims.

All you need to do to correct this is go to int init() and add this to the adaptation block:

Code: Select all

   RecoveryBreakEvenProfitPips*= multiplier;
   RecoveryTrailingStopAt*= multiplier;
   ReEntryLinePips*= multiplier;
: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.
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: My shell EA code

Post by SteveHopwood »

The latest version of the bare-bones shell is in post 1. This has Lifesys' pips-conversion code.

I have changed the names of the externs such as TakeProfit to TakeProfitTarget etc. These need to be doubles for pip conversion, so I have retained the old TakeProfit etc variables, turned them into doubles and set them to the value of their related externs at the start of int init().

Paul has also run his slide rule over the management features and corrected some bloops. These functions should be watertight now.

I have added Slope to all this; I think Slope is going to feature in most trading systems from now on.

I have not bothered updating the full version - I never use it. Much easier is to use the bare-bones version and copy across anything that is needed from the full version.

: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.
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: My shell EA code

Post by SteveHopwood »

Latest update to my bare-bones shell code in post 1.

I had added the external inputs for Slope, and the code to use these to generate a trend definition, but not actually added trend consideration to void LookForTradingOpportunities().

A teensy bit worrying that nobody else appeared to have noticed this humongous bloop. You guys do understand that I am not omnipotent, don't you?

If in doubt, ask Gary, Matt. George, either of the Pauls, spotdespot, Philippe......... They will cheerfully confirm my utter unomnipotenceness. :lol:

When using my code, always bear in mind my signature.

: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.
patman
Trader
Posts: 68
Joined: Sat Dec 10, 2011 1:48 am

Re: My shell EA code

Post by patman »

Hi Steve,

I was wondering...

You use void PFactor() to calculate factor (10000, 1000, 100 depending on symbol)
Then values are divided by factor in calculations.

Point has value of 0.00001, 0.0001, 0.001 depending on symbol
Why not multiply by 10*Point instead of dividing by factor?
Or is Point different on 4 & 5 digit crims?

What am I not getting?


Pat
Lifesys
Trader
Posts: 126
Joined: Wed Apr 25, 2012 2:05 am
Location: Echuca Victoria. Australia

Re: My shell EA code

Post by Lifesys »

Hi Patman
Most Empty4 programmers start from the wrong end of the number because it seems no-one expected the plethora of Digits or Points. Pips has a definition = 1 /100 UScent.
This has little to do with the points/digits used for various pairs by various companies.
Saw a company recently that used 2,3,4 or 5 Digits almost randomly!!!
Pipfactor starts at the correct position - where the decimal point is, relative to a unit price!

I may be new to MQ4 but started programming Fortran with punched cards over 40 years ago and amazed at so many dumb ideas to try and fix a simple problem because people start from the wrong end. Forget Points, Digits or multipliers, unless you are formatting output.
Some simple solutions once PFactor routine is installed.
1. (Ask -Bid) * Pipfactor // always gives spread in pips,
spread=MarketInfo("EURUSD",MODE_SPREAD); // gives arbitrary points NOT Pips.
2. PipsLong = (Close - Entry ) * Pipfactor;
PipsShort = (Entry - Close ) * Pipfactor;
3. StopLossPrice = Entry - StopLossPips /Pipfactor; etc.
This works ALL the time with any company, for different instruments or commodities just add a line to the routine. eg SP30 factor = 1.0;
regards
Paul
Post Reply

Return to “Coders Hangout”