Structure rules. Learning how to structure programmes, exploring possibilities, errors, solutions, etc. - page 14

 
C-4:
In this case we will have to store the history of signals, which is very expensive. Let's again look at crossing of 2 averages. Suppose we restarted the EA. There is no new cross for entry and the EA will somehow need to restore its trading history and understand that there was a crossover and that it should now be in the Buy state and that this signal has been processed and we should not open a new position, but we will need to find the old position, but it will not be easy to find, because the current position may not necessarily belong to only one EA ... All in all, it is a nightmare. This is the thorny path suggested by hrenfx: to write a history tester in every robot, which would collect historical signals, calculate whether they worked or not, and then store volumes of strategies, etc. As a result, the complexity of development increases by an order of magnitude, while there is still no reliable solution.

Signal history is an indicator, indicators are designed for this purpose, to make calculations, generate signals and upload them to the Expert Advisor.

And do not say that indicators are re-drawing, write indicators that are not re-drawing and you will be happy.


No one can lead us astray, we don't give a shit where we are going :)

 
C-4:

How could it not matter!? Any strategy, at its logic level, always knows its current state!

Here is the basic problem. I'm familiar with it, I've gone through all the nooks and crannies here. And it's wrong.

The strategy doesn't need to know its history. The strategy should look forward, not backward. What happened is already in the past and there is no going back.

Take a simple crossover strategy: it has only two states, it is either buying or selling. Without memorizing its position, it will open a long position every time it sees that the fast average is above the slow one. So what's the synchronizer to do? You tell him: "No, you already have a long position, I will not give you another one".

:)

Well I already wrote, you are solving a non-existent problem. The problem seems real only with "order" thinking. With netting thinking it doesn't exist.

I'm not talking about your or my thinking, I'm talking about the thinking of the program (strategy).

In an order-based system the strategy is a producer of discrete buy/sell/close signals. In a net-based system the strategy outputs a number (double) - the recommended market position.

Let's use the example of two wagons to show how a rollover netting TC will produce its product, say, when trading a constant lot (pseudocode):

 Pos = Sign(MA(ShortPeriod) - MA(LongPeriod));

That's it.

The strategy will hold +1 on the output as long as the short swing is higher than the long, and -1 when it is lower.

Decisions about what orders to place/close for keeping those positions at the appropriate moments are taken by the market driver. The strategy doesn't need to bother with it, its role is more aristocratic and it doesn't care about all that mercantile stuff. The driver takes the recommended position of the symbol, subtracts the actual position from it and displays the difference. If the difference is equal to zero, it does nothing.

My solution is universal, the strategy decides by itself how many orders and in which direction it can keep open.

Does the strategy have to worry about orders at all? The market driver decides on these questions.


If you want one position to buy and two to sell, no problem.

Is it possible to laugh here? This is exactly the problem - it's called a "lock".

I have all potential locks unlocked BEFORE the aggregate position of several input strategies is submitted to the market driver:

  Pos=0;
  for (i=0; i<StrategyCount; i++)  Pos+= Strategy[i].GetPos();
  MarketDriver.Synhronize(Pos, Err);

The base class has all the information it needs to make decisions. At the terminal level, there is no net position, while the strategy itself works in the comfortable multi-position mode.

Expert Advisor created by my proposed template will automatically have the properties of a multi-expert. I won't have to add or modify anything. Positions of different EAs on one symbol won't collapse into netting, it's as easy to program a grid or a locker in this pattern as in any other strategy. In other words, the full unification of program implementation is achieved, regardless of the Expert Advisor logic!

Uh... my solution is even more versatile when you consider that the locks don't even arise in it. Lock lovers don't go with me. I go with them.
 
MetaDriver:

...

The strategy will hold +1 on exit as long as the short is higher than the long, and -1 when it is lower.

The market driver decides what orders to place/close to maintain those positions at the appropriate moments. The strategy does not need to bother with it, its role is more aristocratic, it does not care about all this mercantile fuss.

Does the strategy even need to worry about some kind of orders? The market driver decides these small details for me.

...

That's all very well of course, but what about strategies whose current "recommendation" depends on a previously opened position. Suppose a strategy is actively pyramiding and it has such a condition (pseudocode):

if(LastPosition.NetProfit > 400 && LastPosition.PositionType == Long)
{
   double volume = LastPosition.Volume + 1;
   BuyAtMarket(volume, "Entry long by strengthening");
}

Another example of how the recommendation system would handle such a simple condition (pseudo-code):

if(LastPosition.NetProfit < -400)
{
    CloseAtMarket(LastPosition, "Exit position by stop-loss");
    if(LastPosition.PositionType == Long)
       ShortAtMarket(volume, "Entry long by revers")
    else
       BuyAtMarket(volume, "Entry short by revers")
}
In reality, there may be a lot of such conditions.
 
MetaDriver:
That's the basic fuzzy thing. I'm very familiar with it, I've scoured every nook and cranny in here. And it's wrong.

Strategy has no need to know its history. Strategy should look forward, not backwards. What has happened has already happened in the past and there is no going back.

Why are you shouting :) that's not what he said.


Any strategy, at the level of its logic, always knows its current state!

It's about the current state, not the history.
 
C-4:

This is all very well of course, but what about strategies whose current "recommendation" depends on a previously opened position. Suppose the strategy is actively pyramiding and it has this condition (pseudo-code):

These strategies definitely need to be healed, at the level of trading philosophy. Namely, this particular hole in the head should be healed: "current recommendation depends on a previously opened position".

The current recommended position should never depend on any action previously taken in the market.

 
sergeev:

Why are you shouting :) that's not what he said.

it says current state, not history.

I'm not communicating with what he said, I'm communicating with what he meant. He was referring to the previous current state.

:)

 

:)

In fact, for my scheme, there are no principal obstacles to create strategies that take into account past trades.

In more academic terms: A system without memory can easily simulate a system with memory. To do this, the memory is simply moved outside the system - it becomes another input indicator. This is quite enough. The strategy itself remains a "system without memory" and this is good and right.

 
MetaDriver:

The current recommended position should never depend on actions performed earlier in the market.

What about robots "issuing their own recommendations" whose signals are one-sentence? The robot saw a big up candle - a buy signal. The next bar is a normal one and there is no signal. If the robot does not remember its status, its recommendation on this bar is already null, while the robot that remembers it is not null but has a long position. But those are two identical robots.

MetaDriver:

I'm not communicating with what he said, but with what he meant. He was referring to the previous current state.

Ah, so that's what I really meant! I'll know:)
 
C-4: ... That's all very well of course, but what about strategies whose current "recommendation" depends on a previously opened position. Suppose a strategy is actively pyramiding ...

The point is that the top-starter is probably not a strategy, but a price forecaster.

MetaDriver: ... The task of a strategy is to predict whether the market will go up or down at the next point in time, and with what probability. The recommended market position depends on this. What was there in the past, whether there are open (in either direction) positions or not, is absolutely unimportant.
And what you(C-4) are talking about is the work of the money management module that takes both predictor readings and past trade results as an input(some kind of function). If there is no MM, then the final trading algorithm, in fact, turns a virtual predicator position (which does not care about past results of trading) into a real one, where future market direction is the sign of recommended position, and confidence/likelihood is proportional to the volume of the same position.

MM module is a layer between Forecaster and Driver, and results can be anything, from capitalization and risk limit (relative drawdown in X ... hours/trades/pips movement) to radical reversal of forecaster recommended position.

 
C-4:

What about robots "issuing their own recommendations" whose signals are one-sentence? The robot saw a big up candle - a buy signal. The next bar is a normal one and there is no signal. If the robot does not remember its status, its recommendation on this bar is already null, while the robot that remembers it is not null but has a long position. And those are two identical robots.

These robots should definitely be treated. The treatment may be very simple. All you need is motivation. That's the main thing.

And to be motivated, they need to see and appreciate the tremendous superiority of netting thinking over order thinking. As long as they're sick, I won't let them anywhere near the healthy population - let them sit in quarantine...

:)

Ah, so that's what I really meant! Good to know:)
Why not? Do I have to apologise? Or did I guess right? ;-))