Once a Month EA

Locked
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Once a Month EA

Post by SteveHopwood »

This thread is now locked. Please read the last three posts to see why. Send me a pm if you want it reopening.

SERIOUS WARNING
  • Most Forex traders lose all their money.
  • Using the robot posted here in trading Forex does not guarantee success.
  • Trading this robot could lead to serious financial loss.
  • Trading this robot without understanding its underlying trading strategies guarantees traders will lose their money.
  • This is not a set-and-forget ea; there is no such thing and anyone who tries to claim there is, is either stupid or lying. This ea requires frequent manual intervention.
  • At best, a trading robot is only 90% as good as the manual strategy it trades. At best. At worst, it can be much less effective. If the strategy is rubbish, so is the robot.
  • To trade this robot, you have to understand:
    • How to use EA's.
    • The concept of basket trading.
I am trading OAM on my live Cowboy IBFX play account and am making good pips. Follow my lead only after you have demo-traded for a couple of months and are happy with what it does.

Bob in his 10.7 thread, taught us that once a W1 trade direction is established, the market tends to continue in that direction for most of the week. This led to my developing Once a Week, then Once a Day, then Once a Something - find them all in the Automated trading systems sub-forum.

I was musing on this early one morning after the deafening dawn chorus did its thingy at about 5.00 am. I wondered if this might also apply to the Weekly, so I sat at my screen to have a look.

Before reading on, try this guys.
  • go to one of your demo platforms and load up a spare chart.
  • change to the monthly time frame and look at the candles.
  • here is what you will see:
    • most candles are full bodied.
    • many have a small wick in the direction the candle moved, indicating that the market reached a high or low before the end of the month, then retraced.
    • even those with a wick at both ends usually have a large body and a much longer wick at the end that reflects the up or down movement of the candle, indicating a strong movement in that direction followed by a retrace before the end of the candle.
    • 'spinning tops' etc tend to have very small bodies, indicating large movements in both directions, each followed by a retrace.
Now pick an interesting looking candle with a decent wick at one end. Drag a vertical line to it to mark the opening of the candle and drop down to the W1 chart and scroll the chart until you get to the line. See how the second and third weeks after the line are often a strong surge in the direction the MN1 candle ends up showing, and the fourth is a retrace. This pattern repeats over and again. No, not absolutely every time but over and again.

Now find a 'spinning top' and repeat this process. Amazing how often the first week is a surge in the direction of the smaller wick followed by a retrace, then a bigger surge in the opposite direction followed by a retrace back towards the MN1 open price.

Do the above first for a few minutes. It will whet your appetite.



...........................................................................................

Welcome back.

Posts 2 and 3 contain an indi and an analysis ea that you might care to play with. Read the posts and see.

Moving on, Once a Month attempts to take advantage of the movement on the MN1 chart once it is established. It will look at the market during your chosen order opening period, and buy if the market is > MN1 open, or sell if below. OAM is a multi-pair trader, so you only need to load it onto one chart and it matters not a jot which chart or time frame you use. The attached template allows you to quickly set up a chart that has no candles to get in the way of the information display.

The inputs
  • PairsToTrade is a comma-separated list of the pairs you wish to trade.
  • Average simulated profit calculation. This is the average profit that would be made by trading in the direction that the MN1 candle traveled and closing at the furthest extent of the move. This is a hypothetical figure and it remains to be seen how useful this is.
    • AverageTpMonths: the number of months over which to calculate the average.
    • DayOfMonthStart: the trading day of the month to start measuring the average. See 'Day inputs calculation' below.
    • TakeProfitMultiplierPercent: OAM multiplies the average profit by this percentage to create an individual TP for each trade. A zero value stops OAM from sending a take profit.
  • Trading time inputs:
    • SendTradesDay: this is the trading day the OAM will use to decide when to open our trades. See 'Day inputs calculation' below. The default of 10 is roughly half way through the month, so the market direction is usually established by then. It remains to be seen how accurate this is, so play with the simulator in post 3 to decide the value of your input.
    • SendTradesHour: come our trading day, AOM will wait for SendTradeHour to arrive and then start sending the trades. This input value in your broker time, so use the time of day displays at the to of the chart to calculate the broker time that equates to the hour of day you wish to start trading. OAM will continue to attempt to send new trades for as long as it takes to send them - hours if necessary. It detects a trade closed at take profit and will not send another.
    • CloseTradesDay and CloseTradesHour: go on, take a guess.
  • Trade stacking inputs. Ignore this. I cannot make the code work and have removed it. These implement an idea by Spiderx; instead of entering the whole trade immediately, enter bit by bit as the market moves in our favour. The exposure is limited to the initial lot size when the market immediately moves against the trade - as it often does. OAM sends one market trade at a smaller lot size than that of a full trade, and then pending orders to make up the full trade if conditions work out for us.
    • MaxStackTrades: the number of pendings to be sent. A zero value turns off stacking.
    • DistancePerStackPips: the number of pips between each pending trade.
    • LotPerStack: the trade size for the pendings.
  • Bob's 240 H4 moving average trend filter. We have been trading OAM for 3 months at the time of making this edit and have learned the futility of fighting the overall trend. Read about how Bob's filter detects the market's overall trend in any of the umpteen Shell User Guides littered all over this forum, or in Bob's 10.x threads. The filter is enabled by default. Disable it by setting MaPeriod to zero.
  • Swap filter: look at the AUD, NZD and CAD swap display on the chart. Selling these currencies attracts terrifying swap costs that will mount quickly if a trade runs for a couple of weeks.
  • Odds and ends:
    • DisplayGapSize is the chart display offset from the left margin so that a trade notification does not interfere with the information.
    • ShowPairInfo; set this to false to stop OAM showing the individual pair data.
Day inputs calculation
There are three inputs that refer to days (DayOfMonthStart, SendTradesDay, CloseTradesDay) and it is crucial that you get your head around how to calculate them.

They have nothing to do with dates. They are concerned with the number of trading days in the month. OAM counts the first day of the month as day 1, regardless of the day of the week this is. It ignores Saturday or Sunday candles and counts only the D1 candles that open Monday to Friday.

Take SendTradesDay as an example, with the default of 10. Suppose the first of the month falls on Thursday. Ten trading days would take us to the 14th of the month, and OAM will send the trades then. This avoids the situation where we forget that any actual date the bot had to work with comes during the weekend.

The chart display
There are two inputs at the bottom of the inputs window that allow you to control the information displayed on the chart:
  • ShowPairInfo:
    • Each pair shows information to help you decide whether to trade individual pairs:
      • the current Bid. Remove the pair if this is zero because it means your broker does not offer it for trading.
      • MA is Bob's moving average value, followed by the trend direction this indicates.
      • the pair's spread so you can decide whether this allows sensible trading of the pair.
      • 'Av prof' is the average profit calculated by OAM at the start of each month.
      • Long and Short swap. Just look at those high swap pairs negative swaps. Ouch.
      • The pair's movement up or down relative to the MN1 open, and by how many pips.
  • ShowTradesInfo:
    • This display shows details of open trades:
      • Ticket number.
      • Pair.
      • 'Current' is the current direction of the MN1 chart and the size of the movement as in, "Up/down x pips".
      • MN1 open price.
      • The trade's open price.
      • The direction of the MN1 candle at the time the trade was sent, and the size of the movement.
      • The order type in brackets.
      • Whether the trades is 'winning' or 'losing' and by how many pips.
    • The trades display information is intended to help us answer some key questions:
      • do we need a minimum pips movement before allowing a trade?
      • do we need a maximum pips movement and refuse the trade if the market has already moved by more than this extent?
      • should we be trading on a set day and from a set time, or should we be allowing OAM to enter a trade as soon as the market has moved x pips in one direction?
      • what do we do about losing trades? Hedge them? Close them and open in the opposite direction? If so, when?
      • can we evolve a system of adding to winners? If so, do we trade without a take profit and simply close the entire basket towards the end of the month?
Money management
Each trade will be sent with its own take profit; OAM takes no further part in money management, so use these for more detailed trade management: Keeping track with iHistory
The attached iHistory indi is the indi I use to keep track of my progress and generate the pictures I post here. Copy it in your platform's Indicators folder. Open a chart you do not trade, add the Blank template to it and drag iHistory onto the chart. It works with the information you have in your History tab. Sometimes it needs reloading before showing any information, especially at the weekends.

Conclusion
We will have to see what extra features will be helpful. For now, use the analysis ea in post 3 to see which combination of order opening days and take profit figures would have worked best over the last year or so, and make these your inputs.

Thingies for us to consider:
  • dealing with losing trades.
  • adding to winning trades.
  • do we need OAS-style minimum and maximum market movement at order sending time?
Have fun.

:xm:

Matters of general interest
Go here to download and run the script that will fill your platform's missing chart history: http://www.stevehopwoodforex.com/phpBB3 ... f=15&t=254
Read this post:
http://www.stevehopwoodforex.com/phpBB3 ... p?f=6&t=78 Newbie traders, read this for inspiration and warning. Those of you who have suffered losses, read it for inspiration.

Masterly summary of hedging: http://www.forexfactory.com/showthread. ... ost4977179

EA coding
I receive may requests to code EA's. Traders, if I code your EA for free, then I will share it here. If you want me to code your EA without sharing, then my fee is $100 payable into my paypal account. I explain why at http://www.stevehopwoodforex.com/phpBB3 ... ?f=15&t=79, at the bottom of the post.

Useful utilities/EA's/scripts
You do not have the required permissions to view the files attached to this post.
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. [email protected] 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: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Once a Month EA

Post by SteveHopwood »

Bob in his 10.7 thread, taught us that once a W1 trade direction is established, the market tends to continue in that direction for most of the week. This led to my developing Once a Week, then Once a Day, then Once a Something - find them all in the Automated trading systems sub-forum.

I was musing on this early this morning after the deafening dawn chorus did its thingy at about 5.00 am. I wondered if this might also apply to the Weekly, so I sat at my screen to have a look.

Before reading on, try this guys.
  • go to one of your demo platforms and load up a spare chart.
  • change to the monthly time frame and look at the candles.
  • here is what you will see:
    • most candles are full bodied.
    • many have a small wick in the direction the candle moved, indicating that the market reached a high or low before the end of the month, then retraced.
    • even those with a wick at both ends usually have a large body and a much longer wick at the end that reflects the up or down movement of the candle, indicating a strong movement in that direction followed by a retrace before the end of the candle.
    • 'spinning tops' etc tend to have very small bodies, indicating large movements in both directions, each followed by a retrace.
Now pick an interesting looking candle with a decent wick at one end. Drag a vertical line to it to mark the opening of the candle and drop down to the W1 chart and scroll the chart until you get to the line. See how the second and third weeks after the line are often a strong surge in the direction the MN1 candle ends up showing, and the fourth is a retrace. This pattern repeats over and again. No, not absolutely every time but over and again.

Now find a 'spinning top' and repeat this process. Amazing how often the first week is a surge in the direction of the smaller wick followed by a retrace, then a bigger surge in the opposite direction followed by a retrace back towards the MN1 open price.

Do the above first for a few minutes. It will whet your appetite.



...........................................................................................

Welcome back.

Download the attacked indi into your platform's indi folder, close down and restart your platform. Go back to your MN1 chart and drag the indi onto it. For now, immediately select a lower time frame then return to the MN1 - there can be display problems when the indi is first loaded.

Immediately, you will see 24 dotted yellow vertical lines that mark the open of each candle. Now drop down to the W1 and a second set of 24 dotted turquoise lines will appear, plus 26 lines of text..

This is the information the chart display is giving you:
  • the yellow lines show the open of the MN1 candle.
  • the turquoise show the start of the period from which the indi is taking its data - by default from 10 days into the month (drop to the D1 to see the exact day).
  • here is what the chart display is telling you:
    • top line of text: MonthsToAnalyse = 24 DayOfMonthStart = 10
      • MonthsToAnalyse tells the indi how many months back to display its data and calculate the average profit that would be gained by trading the full extent of the candle.
      • DayOfMonthStart tells the indi the day from which to make its calculations, based on the movement of the MN1 candle up to that day
    • next 24 lines of text:
      • 1 - 24 index the candles to the left of the current one, so 1 is the previous candle and 24 is the 24th one one the left.
      • the MN1 final direction and the overall height of the candle.
      • the opening price at the start of the period selected in DayOfMonthToStart.
      • the pips profit you would have made had you traded in the direction of the movement and closed out at the full extent of that move.
    • the final line of text is the average monthly pips profit of the period being displayed on the chart.
  • Obviously we cannot know when the MN1 candle is about to retrace from its furthest extent, so we cannot hope to make all those pips. That is why I added an average profit calculation based on the difference between the D1 open at the start of DayOfMonthStart and the furthest extent of the market movement during the month. Perhaps by trading in the direction established in the first 10 days or so and using the average pips profit as our TP, we have a decent target to aim for. We also have the option to use my mptm or Paul's mpbm to manage the trades either individually or as a basket.

    Coming up is the EA that will facilitate our trading - opening the trades on the correct day, sending the take profit values, closing outstanding trades on a day and time of the month of our choosing. Those of you with experience of OAD/OAW/OAS will know what I am talking about.

    In the meantime, have a play with the indi:
    • MonthsToAnalyse: how far back in time to look.
    • DayOfMonthStart: the crucial setting. Do we start trading on the 10th day of the month? 5th? 7th? 18th?
    • DrawLines: shows/hides the vertical lines.
    • ShowText: shows/hides the text.
So, get your thinking caps on gals and galesses. All idea welcome.

:xm:
You do not have the required permissions to view the files attached to this post.
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. [email protected] 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: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Once a Month EA is Coming

Post by SteveHopwood »

Attached is a toy for us to play with. Make sure you have read post 2 before using it.

It is intended to simulate the results of Once a Month trading as described in post 1. It is a multi-pair bot and so goes on one chart only - any chart. Use the attached 'Blank.tpl' template to quickly produce a chart without candles to get in the way.

The inputs:
  • PairsToTrade: usual stuff.
  • MonthsToAnalyse and DayOfMonthStart are as they were in the post 1 indi. Note that DayOfMonthStart is not a date but a D1 index. The default of 10 means the ea will simulate trading at the start of the tenth D1 candle.
  • AverageTpMonths: the number of months over which to calculate the average maximum profit available.
  • TakeProfitMultiplierPercent: the percentage of the average maximum profit to use for each trade's take profit.
  • RemoveMyself tells the ea to do its thingy then remove itself from the chart at the next tick. Set this to false if you like to make changes to the inputs via source code editing/recompiling.
This is a very blunt instrument. Profit and loss is calculated, taking buy trades as an example:
  • if the high of the MN1 candle >= the trade's simulated take profit, then the tp is used as the profit for that trade.
  • if tp is not hit, then the simulated open price is subtracted from the MN1 candle close. An MN1 candle closing lower than the simulated open price, the result is a loss.
The display:
  • top line shows your chosen inputs as a reminder.
  • then come the list of pairs with this information:
    • Av = average take profit being used to calculate the individual trade tp.
    • a two letter string indicating the month - Ma for March, Au for August etc. Any oddities showing up here probably means your chart history has gaps.
      • "Down" or "Up" shows the direction the MN1 closed.
      • "B" or "S" showing whether the simulated trade was a buy or a sell. A buy taken when the MN finished down shows that the market had risen above the MN1 open at the time of trading, then subsequently fell. Vice versa for a sell.
      • the simulated profit or loss on the trade.
      • the previous 4 steps are repeated for the next MonthsToAnalyse months. Left is furthest back. Right is latest.
      • "Tot = " is the total profit by the pair over MonthsToAnalyse monthse.
  • then:
    • the grand total of pips profit/loss over the whole analysis.
    • a month by month breakdown of the total profit per month of the entire basket.
All a bit hard to read I know, but there is nothing I can do about that without going into putting all the info into labels - and I cannot be bothered.

Have a play with different input settings go get a feel for what you will be in for when I code the trading ea. We are in for a blast if we even come within 50% of what the simulator achieves - and intelligent use should raise that percentage substantially.

Have fun.

:xm:
You do not have the required permissions to view the files attached to this post.
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. [email protected] 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: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Once a Month EA is Coming

Post by SteveHopwood »

There is a new analysis toy in post 3 folks. Have fun. A little gentle drooling might be in order.

:xm:
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. [email protected] 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.
excalibre30
Trader
Posts: 68
Joined: Sat Mar 08, 2014 7:45 am

Once a Month EA is Coming

Post by excalibre30 »

Yes, I am drooling now.
KingOfCoolville
Trader
Posts: 36
Joined: Sun Dec 04, 2011 4:52 pm

Once a Month EA is Coming

Post by KingOfCoolville »

Looks interesting.
User avatar
zader
Trader
Posts: 90
Joined: Fri Jul 06, 2012 8:46 am
Location: Rundown NW England

Once a Month EA is Coming

Post by zader »

What a difference a day can make :shock:
OAMeaav.png
21 pairs Global Prime. AUDCAD,AUDCHF,AUDJPY,AUDNZD,AUDUSD,CADJPY,CHFJPY
EURAUD,EURCAD,EURJPY,EURNZD,EURUSD,GBPAUD,GBPCAD,GBPCHF,GBPJPY
GBPNZD,GBPUSD,NZDCHF,NZDJPY,NZDUSD,USDCAD,USDCHF,USDJPY
You do not have the required permissions to view the files attached to this post.
Last edited by zader on Thu May 29, 2014 3:43 pm, edited 2 times in total.
excalibre30
Trader
Posts: 68
Joined: Sat Mar 08, 2014 7:45 am

Once a Month EA is Coming

Post by excalibre30 »

Did you tally this one by one on a spreadsheet? Cool.

So which day is the best?
User avatar
zader
Trader
Posts: 90
Joined: Fri Jul 06, 2012 8:46 am
Location: Rundown NW England

Once a Month EA is Coming

Post by zader »

excalibre30 » Thu May 29, 2014 3:35 pm wrote:Did you tally this one by one on a spreadsheet? Cool.

So which day is the best?
Table updated to show average, 7 comes out on top but I'm sure Steve & the other brains here will tweak & tune it to get rid of those nasty red numbers.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Once a Month EA

Post by milanese »

You will find the EA and all needed information new in post 1 :cheer: :cheer:

Thank you Steve :xm:

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Locked

Return to “Automated trading systems”