Baluda Slope Strength auto-trader

Share your 10.x automated traders here.
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.

Baluda Slope Strength auto-trader

Post by SteveHopwood »

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 tells you there is, is either a liar or an idiot. This EA will need 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:
My apologies for what is about to happen, but the ridiculous, lazy and stupid here make it essential that I batter you over the head with what seems to me like a really simple point.

Ready?

Here goes:
Listen, you pathetic, pea-brained, dim-witted cretin: even begin to consider using this robot without understanding 10.2 and you will lose all your money.

Sorry about that, but I needed to make a point. Are you a pathetic, pea-brained, dim-witted cretin? No? Then do the reading required to trade successfully. You must understand the 10.2 Tma Slope indicator for any of this to make any sense.

DO NOT USE THIS EA ON A LIVE ACCOUNT. IT IS EXPERIMENTAL.

Intro
Paul (user name Baluda) has created/adapted two fantastic Slope strength indis: Slope Strength; Currency Slope Strength. They both have the same calculation engine and display the Slope data in different ways. Both have a average strength of the individual currency on the far right of the screen.

This EA uses the information in the summary to create pairs for trading.

Baluda does not need any of the indicators from 10.2. Thanks to Paul (Baluda), the code for them is subsumed within the EA. I suggest you have one of the attached indi's on your chart so you can confirm the accuracy of the figures displayed by Baluda.

Paul's contribution here is monumental. He joins the list of Incomparables: TIP - The Incomparable Paul; TIB - The Incomparable Bob; TIG - The Incomparable George; TIGA - The Incomparable Garry; TIPH - The Incomparable Philippe. I just enjoy confusing people. :lol:

TIP handed me the Slope calculation code on a plate. All I needed were a couple of tiny mods, so the guts of thie ea come from Paul.

Chart
Baluda is a multi-pair ea. He goes on any chart you fancy - just one; make it gbpjpy because it is one of the most volatile and so has regular ticks. Time frame does not matter.

Trade entry
Baluda identifies the strong currencies and pits them against the weak.
  • - HtfTimeFrame is the higher time frame for measuring Slope strength. This defaults to the D1 and you should mess with this only if you really know what you are doing.
    - HtfBuyLevel: default 0.4, or Buy in 10.2 terms.
    - HtfSellLevel: default -0.4, or Sell in 10.2 terms.
'Htf' is 'higher time frame', in anticipation of some lower time frame filters to be added later on. I don't plan any, but they will emerge.

You can set the levels in these inputs at any figure you please, but remember 10.2 basics:
  • >= 0.4 is buy and look to take profit at a major resistance.
    >= 0.8 is buy-and-hold and look for further 'stack' entries as the trend continues.
    <= -0.4 is sell and look to take profit at a major support.
    <= -0.8 is sell-and-hold and look for further 'stack' entries as the trend continues.
Looking at my chart today (Sunday 2nd June) for an example of how Balada triggers trades, and using round figures for simplicity:
  • - JPY is 0.9: GBP is -0.8, so we are looking to buy the yen and dump sterling. These two combine in GBPJPY, so we sell the pair. If the values were reversed and sterling was on top, we would buy the pair.
    -
For now, it is that simple. The IndiReadTimeFrame input tells Baluda to calculate the Slope strength at the start of each candle represented by this input - defaulting to M1. This also controls when B looks for opportunities to send a trade, or close open trades, at the start of each new candle.

Lots(v1e)
If 'AccountRiskUnit' is set to non zero value, Baluda will calculate the lot size according this percentage and the ATR of the symbol of the trade.

Trade exit
This is a blunt instrument at the moment. Taking the example sell:
  • - HtfBuyCloseLevel: JPY drops to or below this, and the trade is closed.
    - HtfSellCloseLevel: JPY rises to or above this, and the trade is closed.
What makes this a blunt instrument is this scenario: JPY is falling but GPB is falling faster, or the GBP is rising but the JPY is rising faster, so the profit in the trade is actually growing as it is closed. We shall have to see if this is a problem that needs dealing with.

Trading styles
Described above is the original trading style of this EA: enter a trade if the two currencies of a symbol are above 0.4 and below -0.4, exit the trade if one of the currencies falls below 0.3 or above -0.3. This style is 'TradeByLevel'

Version 1b introduces a new trading style 'TradeByDifference'. This style enters a trade if the difference of the two currencies is above 0.8 and exits if it is below 0.4.

Set the 'TradeByLevel' and 'TradeByDifference' to the style you like. 'TradeByLevel' takes priority if both are enabled.

Tresholds (v1e)
After starting the EA it waits to trade currencies until they have been ranging (>-0.3, <0.3 - user configurable). This prevents opening trades for currencies that are already trending but loosing/gaining strength at the start of the EA. You can enable or disable this feature. Tresholds can be set for currencies and symbols independently.

Swap filter
Newbies may not know that negative swap on CAD, NZD, AUD pairs is crippling. The xxxPairsPositiveOnly inputs are there to eliminate shorting these pairs. When you look on a chart and view a long-term trend on a high timescale, all you see is a yummy movement that raised shed-loads of pips for those who stayed with it.

What it does not highlight so well are those long periods of consolidation where the market ranges around for days, sometimes weeks before taking off again. All through these consolidation periods, the criminal level of swap is massacring your profits.

The positive swap from a buy is wonderful. I love an ADUxxx buy. :lol:

Closing trades manually
Remember that Baluda the EA is a piece of computer code not a sentient being. If you close a trade manually and the conditions are still correct for trading, B will immediately send a fresh one. To close a trade manually, you have first to remove the pair from the PairsToTrade list.

Temporary stuff
There is code to force B to go through its trading-opportunity function even though the markets are closed. This will generate error alerts that you can use to check the accuracy of the trades (remember to turn the TradeSundayCandle to 'true' if you are reading this on Sunday, and off again when you load up on demo for forward testing). I shall remove this in time for market open.

In conclusion
We all had a blast last week with Shelley. Baluda uses 10.2 Tma Slope, and so has every chance of also being successful.

Have fun.

:D



Matters of general interest

Read this post:
http://www.forexfactory.com/showthread. ... ost4923611 Newbie traders, read this for inspiration and warning. Those of you who have suffered losses, read it for inspiration. There is a thread devoted to Sam's trading method at http://www.forexfactory.com/showthre...25#post5118825

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.forexfactory.com/showthread. ... ost4431794, at the bottom of the post.

Useful utilities/EA's/scripts
Matt's chart-population script at http://www.stevehopwoodforex.com/phpBB3 ... 5733#p5733. Use this every time you start a fresh platform.
MaryJane has posted a fabulous utility to allow us to resize EA input windows: http://www.forexfactory.com/showthread.php?t=299017
Multi purpose trade manager: http://www.forexfactory.com/showthread.php?t=89371
Account equity analyser: http://www.forexfactory.com/showthread. ... ost4693716 Also at http://www.forexfactory.com/showthread. ... ost4709098, which includes a template for both USD and the Euro.
Past-trades display indi by squalou; shows a graphical display of the success/failure of trades in your History tab. Breathtaking piece of work. http://www.forexfactory.com/showthread. ... ost3830610
My shell EA – the code I use to produce EA's so quickly. http://www.stevehopwoodforex.com/phpBB3 ... p?f=5&t=15
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. 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.
phil_trade

Re: Baluda Slope Strength auto-trader

Post by phil_trade »

Steve

You are really the most prolific serials coders :lol:
User avatar
monkeh
Trader
Posts: 72
Joined: Fri May 04, 2012 2:40 pm

Re: Baluda Slope Strength auto-trader

Post by monkeh »

i think i need to buy mooooore hardware :D

thanks a million, Steve,
-bows-
User avatar
Zypip
Trader
Posts: 148
Joined: Thu Apr 26, 2012 9:44 am

Re: Baluda Slope Strength auto-trader

Post by Zypip »

:lol: :lol: :lol:

THE FUN NEVER ENDS ON YOUR FORUM STEVE

:lol: :lol: :lol:
garyfritz

Re: Baluda Slope Strength auto-trader

Post by garyfritz »

Steve, there's an oops in LookForTradeClosures():

Code: Select all

      //Find the indexes for the two currencies
      int Index1 = GetCurrencyIndex(ccy1);
      int Index2 = GetCurrencyIndex(ccy1);
Second one should be ccy2.

For comparison / verification purposes I looked at the current values from Baluda's strength/slope calculations (from the EA Comment()) vs. the values from my currency strength indicator. I scaled my values to cover the same range as his.
Baluda.gif
They're mostly fairly similar, but there are some significant differences. E.g. Paul's numbers have NZD as one of the weakest currencies, while my indicator has it being one of the strongest. My indicator says NZD has been gaining strength since about the 23rd.

I looked at NZD and CAD, since CAD (by my indicator anyway) is near zero and pretty flat. That should be a neutral contribution. So if NZD is weak, NZDCAD should be going down. If NZD is strong, NZDCAD should be going up.
NZDCAD.gif
Clearly it's been heading up for the last several days -- roughly since the 23rd.

Most other NZD pairs seem to indicate a strong NZD. The EA calls for NZDUSD and NZDJPY to go down, but they've been pretty flat since NZD started showing strength. So I'm suspicious of the weak NZD number.

Overall, though, the pairs selected by Paul's values have been moving nicely. Should be interesting to see how this performs! This is almost identical to the EA I wanted to build with my indicator so I'm eager to see it go.
You do not have the required permissions to view the files attached to this post.
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: Baluda Slope Strength auto-trader

Post by SteveHopwood »

garyfritz wrote:Overall, though, the pairs selected by Paul's values have been moving nicely. Should be interesting to see how this performs! This is almost identical to the EA I wanted to build with my indicator so I'm eager to see it go.
Yes, it should be an easy job to replace the Slope code with yours.

Thanks for spotting the oops.

: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.
phil_trade

Re: Baluda Slope Strength auto-trader

Post by phil_trade »

Steve

I never notice that before ( Only Steve want to trade on week end :lol: ), but it seems to have a bug in MQL Help

if (TimeDayOfWeek(TimeCurrent()) == 5 for Saturday

That's why B trigger some trade for me even with TradeSaturdayCandle= false !

Code: Select all

void CreatePair()
{
   //Combine cc1 and cc2 into a pair, and attempt to trade.
   //ccy1 holds the strong currency; ccy2 holds the weak cyrrency.
   //If the strong is the first in the pair, buy; if not, sell.
   
   //Do not trade the Sunday candle
   if (TimeDayOfWeek(TimeCurrent()) == 6 && !TradeSundayCandle) return;
   //Saturday candle for those in upside-down land
   if (TimeDayOfWeek(TimeCurrent()) == 5 && !TradeSaturdayCandle) return;
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: Baluda Slope Strength auto-trader

Post by SteveHopwood »

phil_trade wrote:Steve

I never notice that before ( Only Steve want to trade on week end :lol: ), but it seems to have a bug in MQL Help

if (TimeDayOfWeek(TimeCurrent()) == 5 for Saturday

That's why B trigger some trade for me even with TradeSaturdayCandle= false !

Code: Select all

void CreatePair()
{
   //Combine cc1 and cc2 into a pair, and attempt to trade.
   //ccy1 holds the strong currency; ccy2 holds the weak cyrrency.
   //If the strong is the first in the pair, buy; if not, sell.
   
   //Do not trade the Sunday candle
   if (TimeDayOfWeek(TimeCurrent()) == 6 && !TradeSundayCandle) return;
   //Saturday candle for those in upside-down land
   if (TimeDayOfWeek(TimeCurrent()) == 5 && !TradeSaturdayCandle) return;
TimeCurrent() returns the most recent time of the current candle, which is the Friday candle, so B tries to send the trades.

This filter is for our friends in upside-down land, to avoid getting into trades too late in the week.

: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.
phil_trade

Re: Baluda Slope Strength auto-trader

Post by phil_trade »

SteveHopwood wrote:
phil_trade wrote:Steve

I never notice that before ( Only Steve want to trade on week end :lol: ), but it seems to have a bug in MQL Help

if (TimeDayOfWeek(TimeCurrent()) == 5 for Saturday

That's why B trigger some trade for me even with TradeSaturdayCandle= false !

Code: Select all

void CreatePair()
{
   //Combine cc1 and cc2 into a pair, and attempt to trade.
   //ccy1 holds the strong currency; ccy2 holds the weak cyrrency.
   //If the strong is the first in the pair, buy; if not, sell.
   
   //Do not trade the Sunday candle
   if (TimeDayOfWeek(TimeCurrent()) == 6 && !TradeSundayCandle) return;
   //Saturday candle for those in upside-down land
   if (TimeDayOfWeek(TimeCurrent()) == 5 && !TradeSaturdayCandle) return;
TimeCurrent() returns the most recent time of the current candle, which is the Friday candle, so B tries to send the trades.

This filter is for our friends in upside-down land, to avoid getting into trades too late in the week.

:D
Ok, but for your Temporary stuff
Temporary stuff
There is code to force B to go through its trading-opportunity function even though the markets are closed. This will generate error alerts that you can use to check the accuracy of the trades (remember to turn the TradeSundayCandle to 'true' if you are reading this on Sunday, and off again when you load up on demo for forward testing). I shall remove this in time for market open.
why not use TimeLocal() to allow desactivation alert ?
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: Baluda Slope Strength auto-trader

Post by SteveHopwood »

phil_trade wrote:
SteveHopwood wrote:
phil_trade wrote:Steve

I never notice that before ( Only Steve want to trade on week end :lol: ), but it seems to have a bug in MQL Help

if (TimeDayOfWeek(TimeCurrent()) == 5 for Saturday

That's why B trigger some trade for me even with TradeSaturdayCandle= false !

Code: Select all

void CreatePair()
{
   //Combine cc1 and cc2 into a pair, and attempt to trade.
   //ccy1 holds the strong currency; ccy2 holds the weak cyrrency.
   //If the strong is the first in the pair, buy; if not, sell.
   
   //Do not trade the Sunday candle
   if (TimeDayOfWeek(TimeCurrent()) == 6 && !TradeSundayCandle) return;
   //Saturday candle for those in upside-down land
   if (TimeDayOfWeek(TimeCurrent()) == 5 && !TradeSaturdayCandle) return;
TimeCurrent() returns the most recent time of the current candle, which is the Friday candle, so B tries to send the trades.

This filter is for our friends in upside-down land, to avoid getting into trades too late in the week.

:D
Ok, but for your Temporary stuff
Temporary stuff
There is code to force B to go through its trading-opportunity function even though the markets are closed. This will generate error alerts that you can use to check the accuracy of the trades (remember to turn the TradeSundayCandle to 'true' if you are reading this on Sunday, and off again when you load up on demo for forward testing). I shall remove this in time for market open.
why not use TimeLocal() to allow desactivation alert ?
'cos I don't care enough to bother. :lol:

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

Return to “10.x EA forum”