The HOLY grail involves..

If you don't know where to start, start here! Don't be afraid to ask questions.

Moderator: moderators

xtremeforex
rank: 50+ posts
rank: 50+ posts
Posts: 119
Joined: Mon Nov 16, 2009 7:43 pm
Reputation: 1
Location: Toronto
Gender: None specified

Postby xtremeforex » Thu Jan 24, 2013 7:14 pm

I will reply back to some of these posts with some detail later. I am currently in Switzerland right now.

Bredin:

I've oversimplified the idea so that core ideas are understood.

Particularly the concept and importance of variable trade sizes (since many people stick to one particular size/percentage always). Adjusting trade size is important when probabilities are in favour. Probabilities are never absolutes. In all cases, however, variable or not, the trade size always remains a low percentage of total account equity. There is never an instance that you would DOUBLE UP a trade size - ever (relative to account equity).

A couple of posts prior I have stated the importance of identifying the "TRUE MEAN." This is integral (and I will get to that later) and how your bot will use/calculate probability to decide that. You would not do this on any mean and there are situations in which you would not do this at all. Your bot will decide when the conditions present the edge or not and whether to TURN ON the functionality. I will reply to your post in detail later.

The whole game is about how to deal with varying probabilities in real-time.

The goal is to build the strategy with parameters that are self optimize-able during trading in real-time and/or using a fixed backward test window - in real time. Like a real-time feedback loop. This is essential because we know the market CAN change.

Strategies that utilize FIXED parameters will fail in the long-run.

My strategy is SIMPLE. What complicates (increases complexity) my strategy is the logic/decisions of how to adjust these SIMPLE parameters i.e. adapting parameters in real-time. If I were to remove this logic, the strategy would comprise of less than a page of code and only work on a known historical window and fail everywhere else.

Keep in mind, I'm condensing what is a comprehensive (but simple) strategy into few words and it is unwise to jump to conclusions ("hokey math") because I haven't even reached 2% of what I'm discussing.

(and I'm definitely no idiot in Math.)
Last edited by xtremeforex on Thu Jan 24, 2013 8:08 pm, edited 2 times in total.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
Dillinger
rank: 50+ posts
rank: 50+ posts
Posts: 56
Joined: Fri Feb 17, 2012 1:23 am
Reputation: 36
Gender: None specified

Re: All about cash flow

Postby Dillinger » Thu Jan 24, 2013 7:24 pm

speed26 wrote:Heres another thought and example about comparing cashflow in trading vs cashflow in conventional business...im going to use a personal experience here:

Lets say we have an 'investment' opportunity in acquiring a rental property.

Cost = 50.000 euros.

Deposit/Margin = 20.000 euros.

Mortgage = 30.000 euros over 10 years = 250 euros / month.

I rent the unit out for 500 euros / month.

Month to month cashflow = 250 euros gross profit.

However, the true VALUE of my unit will fluctuate; it will go up (more than 50.000 euros) and down (below 50.000 euros).

All im doing is collecting the difference between mortgage/interest rates and the income from rent. But the underlying VALUE of my unit will go against me and in favor of me.

But the key is here is that as long as im cash flow positive month to month, the actual underlying value of the unit becomes irrelenvant.

So how does this resemble cash flow in currency trading?
This is what i cannot comprehend (if someone would like to explain?).

Lets say i place a long on E/U and it goes against me. Right now this is a weight on my margin, however, contrary to property, i cannot be cashflow positive from this ONE trade. (meanwhile in property i am).

So in order to regain positive cash flow trading currencies i have to diversify and open more trades to COMPENSATE for the first trade that is negative.

It would be like if i had to purchase ANOTHER property to potentially compensate for the lack of positive cashflow from the first property.

How does business cashflow compare to trading cashflow?

Any thoughts on this?



speed26

This is my take on what I think xtreme is doing or is trying to show us,

and I could be way off course. First of all you need two accounts because

US brokers don't allow hedging(holding a long and short of the same

pair). Like you said if you go long the euro in one account and it starts

going against you before you can take a small realized gain, you can be

trading short in the other account and taking REALIZED gains. Now let's

say the market goes down 300 pips over the week. We know price usually

doesn't go straight up/down. There is usually way more price movement

then the range of the week. A three hundred pip move may have several

hundred more pips of total up and down movement. So by shorting and

buying back in your other account through all this up and down movement

you are able to lock in profits that can't be taking away from you. You

may or may not be able to cover all 300 that the other account went

against you but I would think you could cover part of it at least.

For example even if over two weeks the market goes against your long

position 700 pips, as long as you have been taking REALIZED profit in

your short account you may only be down a few hundred pips net between

them.


Example:

Long account: -700 pips unrealized P/L(can come back to you)

Short account: +500 pips realized P/L (can't be taken away from you)

Price doesn't move in straight lines forever in one direction so eventually it

will find long term support and go back up. Week 3 it finds this support

and goes up 300 pips. now you can close your long position out for a 400

pips loss and your accounts have a realized gain of +100 pips net now.

So by taking profit when available in your short account and having a

size that allows you to survive a large drawdown of several hundred pips.

Eventually the market will go back in your direction and you will be able to

close the floating loss out for a net profit between your two accounts.


speed26 I think you maybe over analyzing these two things.... I may be

wrong but I think xtremeforex was just trying to show that it isnt the end

of the world to have positions is the red as long as your REALIZED wins

out weigh your floating loss or doesn't allow your accounts to have a

margin call. So just like you said, as long as you have positive cash flow

(net positive between your two accounts) it doesn't really matter what the

value of your property(your account with the floating loss) is as long as

you pay the mortgage(transfer money from your other account with

REALIZED wins) to avoid the bank foreclosing on it(margin call).

Like I said take this with a grain of salt because this may not be what xtreme means or is trying to convey to us....

xtremeforex
rank: 50+ posts
rank: 50+ posts
Posts: 119
Joined: Mon Nov 16, 2009 7:43 pm
Reputation: 1
Location: Toronto
Gender: None specified

Postby xtremeforex » Fri Jan 25, 2013 3:13 pm

Moreover, for those following. It would be useful to obtain a copy of Matlab in whatever way you can. I use Matlab R2012b.

If you don't have it, don't worry, I won't jump into it just yet.

It isn't necessary to have it, but when I get into some topics, the hands-on approach may be simpler than 'imagining' it. It may also be the perfect opportunity to face the inevitable - learning something new.

I will try my best to keep the level of Matlab talk at an introductory level.

User avatar
Captain Pugwash
rank: 500+ posts
rank: 500+ posts
Posts: 529
Joined: Wed Sep 14, 2011 7:59 am
Reputation: 166
Location: Insanitary Industries
Gender: Male

Postby Captain Pugwash » Fri Jan 25, 2013 6:20 pm

xtremeforex, I owe you an apology mate - you are not the avatar known as Signalbender - in one of his many Alias's

You passed the SB test with flying colours mate
"MOJO 1)Self-confidence, Self-assuredness. As in basis for belief in ones self in a situation. Esp/In context of contest or display of skill such as going into battle. 2)Ability to bounce back from a debilitating trauma and negative attitude YEH BABY

JogieFX
rank: <50 posts
rank: <50 posts
Posts: 8
Joined: Tue Jan 08, 2013 4:51 pm
Reputation: 0
Gender: None specified

Postby JogieFX » Mon Jan 28, 2013 8:01 pm

xtremeforex wrote:Moreover, for those following. It would be useful to obtain a copy of Matlab in whatever way you can. I use Matlab R2012b.

If you don't have it, don't worry, I won't jump into it just yet.

It isn't necessary to have it, but when I get into some topics, the hands-on approach may be simpler than 'imagining' it. It may also be the perfect opportunity to face the inevitable - learning something new.

I will try my best to keep the level of Matlab talk at an introductory level.



this matlab thing looks pretty complicated.:shock: What is it good for?

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

JogieFX
rank: <50 posts
rank: <50 posts
Posts: 8
Joined: Tue Jan 08, 2013 4:51 pm
Reputation: 0
Gender: None specified

Postby JogieFX » Tue Jan 29, 2013 7:04 pm

JogieFX wrote:
xtremeforex wrote:Moreover, for those following. It would be useful to obtain a copy of Matlab in whatever way you can. I use Matlab R2012b.

If you don't have it, don't worry, I won't jump into it just yet.

It isn't necessary to have it, but when I get into some topics, the hands-on approach may be simpler than 'imagining' it. It may also be the perfect opportunity to face the inevitable - learning something new.

I will try my best to keep the level of Matlab talk at an introductory level.



this matlab thing looks pretty complicated.:shock: What is it good for?




I watched some Videos on mathworks homepage looks interesting. Seems like a tool for statistics and simulating...... Im asking mr.Google for a copy :wink:

xtremeforex
rank: 50+ posts
rank: 50+ posts
Posts: 119
Joined: Mon Nov 16, 2009 7:43 pm
Reputation: 1
Location: Toronto
Gender: None specified

Postby xtremeforex » Wed Jan 30, 2013 12:34 am

Dillinger,

That is not what I am suggesting. However, hedging CAN be a useful strategy contrary to the 'experts' that claim "hedging is useless." Hedging is often used incorrectly and that is why people claim it doesn't work. Taking out a LONG and SHORT at the same time is a incorrect way of using hedging!

Speed26:

The problem is, you are focusing and waiting on one-trade. Why not put out several small trades that equal to that one-trade? Therefore, the value of your portfolio would not be directly dependent on the value of an individual trade. Therefore, your "house" value will be free to move (i.e. your portfolio) independently of your your "rent value" i.e. your individual trades.

Think about Expectancy:

Expectancy = AvgWin * PercentWin - AvgLoss * PercentLoss

We know when Exp is positive, we are winning overall. If it is negative we are losing overall.

There are FOUR variables here that control Expectancy, i.e. more moving parts. How can we REDUCE the number of moving parts (variables) to have better CONTROL of Expectancy? How many variables will be a result of this reduction?

Think of this carefully. Hint: Think about what I just said above.

JogieFx:

MatLab is a tool used for Mathematical modelling. I utilize it for neural networks and self-optimization.

Many people are brainwashed into thinking that too much optimization is bad and optimized results should be discarded because we are 'curve-fitting' and the discovered parameters would not work on the future/unseen data.

There is nothing wrong with 'curve-fitting.' It is used in feedback control-systems all the time in aircraft - to maintain RPM of all engines. (I've worked for Lockheed Martin and Northrop Grumman).

What you want to do is avoid 'over-fitting' which is a completely different concept (discussed later).

You want to be 'curve-fitting loosely'- but with relevant/recent data that represent the 'regime' (market behaviour) you're in. The art is in determining what is 'recent data' and understanding the 'possible regime' you're in.

Matlab helps you can develop optimization routines that usually require mathematical equations that can not be adequately implemented in MT4 (i.e. partial derivatives) and even if attempted would result in the implementation to be too slow. (Think about how long optimization takes when just back-testing with several parameters and steps).

With a bit of work, MatLab and MT4 can be made to communicate/pass data to each other. However, in my opinion, MT4 is very unreliable. It comes pre-packaged with low quality data, it doesn't take into consideration very important factors such as slippage, commissions, spread etc. Only use MT4 to check the mechanics of trading (i.e. placing/closing orders, MM etc.). Do not depend on MT4 for any sort of accurate performance analysis. I believe the method in which (MT5) calculates Sharpe Ratio is flawed too. So basically MT hasn't even improved in subsequent major version releases. It's a shame really, because MQL4 is actually a fun and efficient language. Only use MT4 for learning purposes/training wheels.

Many optimization models have been put into ready-made functions that can be called. HOWEVER, it is more than likely, you will need to make your own custom optimization model that incorporates concepts from these ready-made solutions (i.e. Stochastic Gradient Ascent/Descent). Therefore, you may be required to learn the mathematical derivations of the existing optimization theories, to understand HOW they optimize, in order to make them work in a custom way for you.

This is the main-barrier that separates the programmer from the programmer that is also a scientist/mathematician. This is why there are plenty of amazing programmers that have developed hundreds of EA's and strategies that still don't work. They miss out one important ability - self optimization and they can't implement it because they don't understand the math behind it.

Now, all this may sound like I'm contradicting my premise that "trading is simple" and TRO might jump in and call me a "Yale Student."

A working/profitable strategy can actually be SIMPLE but the longevity of that strategy is limited if it can't adapt. I'm sure some successful hedge funds actually have a rather simple mechanical strategy with a very complex optimization routine that alters parameters when the 'regime' changes.

If there is demand, I can teach the mathematics of optimization/neural networks with a focus on software/code implementation in the trading context and attempt to make it easy enough that a high-school student can learn it. However, this would take considerable amount of time/effort on my part, so I need to really see a visible demand and participation to keep me motivated because I have no intention to charge for it - making it harder to stay motivated.

You must be prepared to learn something radically new and there might be a learning-curve involved (that you can overcome). If you give up easily - don't waste your time with my stuff. The edge you want in trading is proportional to how much you're willing to get out of your comfort zone, to do the work (like if I tell you to code something totally irrelevant to trading/forex because the experiment will demonstrate the principle I'm leading you too) and staying motivated. I hope to benefit from this effort by developing lasting friendships and possibly attracting big players who may be interested in working collaboratively. This system of paying it forward works. A former HS student of mine once randomly donated $15,000 to my HS robotics team because he appreciated what the team taught him.

It will be impossible to explain this stuff in a easy way through the forum. I would probably have to make it in a video format.

I've written at length about the importance of optimization. However, all of this is useless if you don't have a strategy that doesn't work to begin with.

Your goal RIGHT NOW should be to develop a strategy that works - even if only for a specific history range. If it fails in another range but passes (considerably) after optimization (with your backtester) for that range. Hang on to it. If it doesn't - throw it out. Also, when doing this optimizing check, make sure you optimize based on all the objective/search functions available to you (i.e. Profit Factor, Net Profit, Max Draw Down etc.) and consider the parameters that exist favourably in all of these search criteria's - not just one.

It would be more useful for me to explain this stuff more than discussing specific strategies because I'm limited by what I can divulge without giving my exact strategy that I have no intention of doing that, therefore I'm only able to let go bits and pieces that may not make sense individually but only as a whole that can't be divulged (i.e. like the whole increasing/decreasing trade size with probability) and consequently making it confusing and unstructured. If I'm limited by what I can say then I'm technically withholding - which is unfair to the learning process.

However, I will try to reveal strategy ideas as we go along but it must be understood that each piece only solves a much larger puzzle.

speed26
rank: <50 posts
rank: <50 posts
Posts: 38
Joined: Tue Mar 29, 2011 6:26 pm
Reputation: 0
Gender: None specified

Postby speed26 » Wed Jan 30, 2013 8:54 am

Hi xtreme,

Im having to take time to think about your comment on expectancy...

As for matlab/programing/logic im definetly in, although i havent a clue how to program - never attempted it before.

So let me get this right: Self optimization (curve-fitting) on specific recent data makes the static system dynamic, providing the concepts it optimizes are based on probability and a 'specific' median? (sorry if it sounds naive).

Thanks for your patience.

xtremeforex
rank: 50+ posts
rank: 50+ posts
Posts: 119
Joined: Mon Nov 16, 2009 7:43 pm
Reputation: 1
Location: Toronto
Gender: None specified

Postby xtremeforex » Wed Jan 30, 2013 9:15 pm

Speed26,

Matlab is one of the easiest programming languages to program in. It is probably easier than MQL and I would go as far to say a terrific starter language because of the ability to quickly get an output.

It is absolutely worth your time to learn this application, it has plenty of universal applications in multiple fields besides trading as well.

A careful google search will give you what you want.

---------------------------------------------------------------

Probability can be used in a few ways.

Support & Resistance is a good (simple) example of where people are using probability without realizing it.

Say the EURUSD reaches a specific resistance level, then reverses, goes down for a while, then goes up, reaches the same specific resistance level, goes down for a while, and repeats this often etc..

When the pair is behaving like this, we say that each time it touches the resistance line, it is called a confirmation. The more confirmations the line has, the more we start to become confident that price will reverse here, so traders may place a SELL order there. They are assuming that the probability of price reversing is high there. They are also aware that the price could break through too - based on past experience - and be wrong. But it is the 'experience' that it can reverse is what gives them confidence. This experience can be probability 'quantified.'

The mechanics of what they are doing (the strategy) is absolutely good, the problem is how they 'internally/naturally calculate' the level of probability they think exists when the price reaches the resistance line. Are they effectively utilizing their 'experience' to make this decision?

TRO's indicators are useful here, because most of them are based on Frequency i.e. How often something occurs.

Now using probability ideas, we could develop a strategy that counts the number of confirmations a resistance line has, counts the number of times it 'respected' the line (reverses), counts the number of times it 'disrespected' the line (break-through and continue) and count the number of times it 'tricked' the line (fake-out/breakout and reverse).

Based on this information over a relevant period of time, we can estimate the current market behavior of this pair to THIS strategy. If the current market behaviour has a high-degree of fake-outs or breakthroughs, we may want to tell our bot to stop this support/resistance strategy and do another strategy automatically, because the market behaviour is not respecting the strategy AT THIS TIME. This does not mean we stop calculating those probabilities because we switched out of the strategy - our bot just shouldn't act on them until they return to conditions that allow the S/R strategy to act and switch out of second strategy.

If the market behaviour has a high degree of respect for the S/R lines, we may want the bot to continue with the strategy until the probabilities show that it is disrespecting it and switch - while STILL keeping track of those numbers which might alert the S/R strategy to return. So in other words, the strategy will keep running, but it is not acting on it's decisions. Multiple sub strategies within a strategy could be running, but only specific strategies are in active control. The decision to give specific strategies control could be based on comparing their individual performance as they are 'psuedo-trading.' i.e. trading but not actually really trading.

In the "S/R" strategy, even when the probabilities of what we want are in our favour, it doesn't mean we will always be right. i.e. The strategy may show that there is a high chance of reversal at the line, but suddenly breaks through and continues The market will do what it wants to do. We can never predict which way it will go. However, it allows us to make an INTELLIGENT decision when the EDGE is in our favour.

This EDGE will depend on the probability of the reversal AND the risk:reward. The RR can also be calculated by the same 'frequency distribution', say the frequency of the size of reversal moves that MAY occur, how we can minimize/maximize the trade size given the probability. If we choose to act on a low probability, we might choose to pick a smaller trade-size, if we choose to act on a high probability we may choose to increase our trade-size.

Say we are getting close to the resistance line and the strategy says there is a 90% chance of reversal but you know that there will be a huge news report (say Bernanke is gonna speak). His news could totally wipe out that 90% chance and while the strategy says GO SHORT, you might want to not to trade but wait - because it is incredibly difficult to quantify the news, because news is subject to a high degree of randomness, subject to interpretation and based on mass psychology.

This is only a simple example of how probability/frequency distribution can be integrated into a strategy.

Optimizing on the other hand, will take the parameters such as the ideal number of counts of each situation i.e. reversal, breakthrough, fake-out to determine the ideal counts/frequencies in which these probabilities will attempt to quantify and display the market behaviour. Like, how many times should we count a confirmation to conclude a resistance line is valid? In different times in the market, perhaps we need only 3 confirmations to show that the 4th confirmation will be respected. Or we may need 20 confirmations to show the 21st confirmation will be respected. It will in fact vary over the time period and historical range - so the optimizer will find what the IDEAL ('average') number is that will maximize the objective function (i.e. profit factor, netprofit, max drawdown etc.) such that optimized count number will work in both the 3 confirmation situation AND the 20 confirmation situation.

Probabilities in the optimization process ITSELF can be used to SPEED up the process by intelligently finding correct route to the right number without having to go through every possible combination that maximizes the objective function. This becomes critical when your attempting to determine/update the count numbers in a real-time nature, where every hour you may be optimizing 3 months of data with 1500 combinations to feed-back to the system with updated counts (parameters).
Last edited by xtremeforex on Thu Jan 31, 2013 12:12 am, edited 2 times in total.

xtremeforex
rank: 50+ posts
rank: 50+ posts
Posts: 119
Joined: Mon Nov 16, 2009 7:43 pm
Reputation: 1
Location: Toronto
Gender: None specified

Postby xtremeforex » Wed Jan 30, 2013 9:46 pm

A good way to think of how 'frequency distribution' can quantify behaviour is think about ourselves.


Scenario A)

You wake up every morning at 7:30 am to go to work. You get to work at 8:30 am - right on time.

Scenario B)

You wake up at 7:30 and you get to work at 8:40 pm - you're late.

1)

Out of 200 working days. Scenario A occurs 30% of the time and Scenario B occurs 70% of the time.

a) Over this period ONLY - What conclusions can we make about your punctuality behaviour?

b) Lets say co-workers at work who arrive early everyday decide to make a bet whether you will arrive on time or not. How should they bet?

2)

Using the same scenario A and B

a) What if the last 100 days was through Winter months with snow delays?

b) What does this say about the relevance of sample data in terms of concluding behaviour?

c) What data should co-workers consider when placing their bets now?

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “beginners forum”