Diablo - page 12

 

I made an Expert Advisor, which places orders as in the author's methodology, but there are differences. It places orders according to levels depending on ATR (if the methodology is a win-win, then what difference does it make from what levels to place). At the beginning of a new day closes and removes all orders (I just do not know how else to close orders that have no TP and SL and that will not bring profit).

You can try to optimise the parameters. I'm just lazy, I don't believe in this strategy.

Files:
 
khorosh:
When criticism is too lazy to be reasoned with, but you really want to say something, it's better to be silent than to muck about.
Don't forget to look in the mirror.
 

Diablo v09.02.12 (Immortal Version)

Orders of two types are placed at a certain distance from the price at equal intervals: Straight orders (Buy Stop up from the price and Sell Stop down from the price) and inverted orders (Sell Limit up from the price and Buy Limit down from the price). Orders Buy Stop and Sell Limit are placed at the same levels (in pairs), as well as Sell Stop and Buy Limit orders.

All orders have the same volume and Stop Loss equal to the step between the orders.

Straight orders (Buy Stop and Sell Stop) have no Take Profit. The inverted orders (Sell Limit and Buy Limit) have the arithmetically increasing Take Profit: the first order (the nearest to the price) has one step between the orders, the second order (a little more distant) has three steps, the third order has five steps and so on.


A script for placing orders:

// Diablo v09.02.12
#property copyright "Jon Katana"
#property show_inputs
extern int Step=0,Spread=0,Levels=0;
extern double Up=0,Vol=0;
int start()
{for(int i=0;i<(Levels);i++)
{OrderSend(Symbol(),OP_BUYSTOP,Vol,Up+(i*Step+Spread)*Point,0,Up+(i-1)*Step*Point,0,0,0);
OrderSend(Symbol(),OP_SELLSTOP,Vol,Up-(i+1)*Step*Point,0,Up-(i*Step-Spread)*Point,0,0,0);
OrderSend(Symbol(),OP_SELLLIMIT,Vol,Up+i*Step*Point,0,Up+((i+1)*Step+Spread)*Point,Up-(Step*(i+1)+Spread)*Point,0,0);
OrderSend(Symbol(),OP_BUYLIMIT,Vol,Up-((i+1)*Step-Spread)*Point,0,Up-(i+2)*Step*Point,Up+i*Step*Point,0,0);}
return(0);}

The system is completely indestructible. Left to itself, in the end it always closes with a profit or at zero.

Very good is the trend without fallback on the step size - the profit increases like a snowball, allowing to collect one price movement several times. On the flat the profit is moderate or goes to zero. The slowest variant is the pattern "dragon", when the price moves in one direction, but rolls back from each level by one step, then goes further. In this case it will just take a little longer to reach profit or zero.

Therefore calculate the step between the levels for placing orders so that the price does not touch the already passed levels by mini-corrections.

The scheme can be left unattended as long as the price does not go beyond the levels where the orders are placed. Another variant is to follow the Diablo and close it when some profit (for example, the size of one step) is reached with subsequent rearrangement of orders again, or just one-time close with profit.

 

Correction in the script: there was a wrong offset on the spread in Sell Limit orders:

// Diablo v13.02.12
#property copyright "Jon Katana"
#property show_inputs
extern int Step=0,Spread=0,Levels=0;
extern double Up=0,Vol=0;
int start()
{for(int i=0;i<(Levels);i++)
{OrderSend(Symbol(),OP_BUYSTOP,Vol,Up+(i*Step+Spread)*Point,0,Up+(i-1)*Step*Point,0,0,0);
OrderSend(Symbol(),OP_SELLSTOP,Vol,Up-(i+1)*Step*Point,0,Up-(i*Step-Spread)*Point,0,0,0);
OrderSend(Symbol(),OP_SELLLIMIT,Vol,Up+i*Step*Point,0,Up+((i+1)*Step+Spread)*Point,Up-(Step*(i+1)-Spread)*Point,0,0);
OrderSend(Symbol(),OP_BUYLIMIT,Vol,Up-((i+1)*Step-Spread)*Point,0,Up-(i+2)*Step*Point,Up+i*Step*Point,0,0);}
return(0);}
 

extern int Step=0,Spread=0,Levels=0;
extern double Up=0,Vol=0.

What parameters should I put here to make it work?

 
Why don't we assign the UP variable to asc, so that orders are placed from the current price....
 
#property copyright "Jon Katana"
#property show_inputs
extern int Step=50,Spread=2,Levels=5;
extern double Up=0,Vol=0.1;
int TotalOrders,i;
int start()
{Up=Ask;
        TotalOrders=OrdersTotal();
        for (i=0; i<=TotalOrders; i++){
                 if (OrderSelect(0,SELECT_BY_POS)==true){
                    if (OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,5,Red);
                    if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,5,Red);
                    if (OrderType()==OP_SELLSTOP) OrderDelete(OrderTicket(),Green);
                    if (OrderType()==OP_BUYSTOP) OrderDelete(OrderTicket(),Green);
                    if (OrderType()==OP_SELLLIMIT) OrderDelete(OrderTicket(),Green);
                    if (OrderType()==OP_BUYLIMIT) OrderDelete(OrderTicket(),Green);
                 
                 }
        }

for(int i=0;i<(Levels);i++)
{OrderSend(Symbol(),OP_BUYSTOP,Vol,Up+(i*Step+Spread)*Point,0,Up+(i-1)*Step*Point,0,0,0);
OrderSend(Symbol(),OP_SELLSTOP,Vol,Up-(i+1)*Step*Point,0,Up-(i*Step-Spread)*Point,0,0,0);
OrderSend(Symbol(),OP_SELLLIMIT,Vol,Up+i*Step*Point,0,Up+((i+1)*Step+Spread)*Point,Up-(Step*(i+1)-Spread)*Point,0,0);
OrderSend(Symbol(),OP_BUYLIMIT,Vol,Up-((i+1)*Step-Spread)*Point,0,Up-(i+2)*Step*Point,Up+i*Step*Point,0,0);}
return(0);
}
I've added a cleanup to the script. I.e. if there are open or pending orders, it first deletes everything and then sets the pending orders according to the parameters...
 
IronBird:

extern int Step=0,Spread=0,Levels=0;
extern double Up=0,Vol=0

What parameters should be entered here to make it work?

Step - step between orders in points (e.g. 20 for a four-digit order or 200 for a five-digit one);

Spread - spread in pips (e.g. 2 for four digits or 20 for five digits);

Levels - the number of levels at which the orders will be placed (for example, 20);

Up - a line above the price, from which the placing of orders will start upwards (orders will be placed automatically with an offset of Step from this line);

Vol - volume of orders (for example 0.1).

 
nikelodeon:
Why don't we assign the variable UP to asc, so the orders will be placed from the current price....

For two reasons:

1) Orders cannot be placed from a certain level (resistance, support, Fibonacci, Rabbit...)

2) There are dozens of orders, and they are not placed instantly. During this time Ask can shift from the initial value, which unpredictably moves the places of placing of orders and their Take Profit and Stop Loss. This will allow the dealing centre to open orders at levels not by a pair, but to "pull" separate orders without catching the second order from the pair, and then to drive them to losses, which would destroy the entire system.

 
JonKatana:

For two reasons:

1) Orders cannot be placed from a certain level (resistance, support, Fibonacci, Rabbit...)

2) There are dozens of orders, and they are not placed instantly. During this time Ask can shift from the initial value, which unpredictably moves the places of placing of orders and their Take Profit and Stop Loss. This will allow the dealing centre to open orders at levels not by a pair, but to "pull" separate orders, without catching the second order from the pair, and then to drive them into losses, which will ruin the whole system.

You can set the first two orders using the current price and calculate the prices of other orders relative to the first order prices. The first two orders may be market orders.