learn how to earn money villagers [Episode 2] ! - page 27

 
YOUNGA:
one line I can't think of - how to catch 15 minutes from the start of the hour on the M1

you can also do this

TimeBar_t = Minute();
 
BeerGod:

you can also do this.

Your version is more elegant and the results are the same

Well then spoilsport - very small MO (0.77) does not scare?

All lied - rushed (You have a lot set up artistically) normal MO=7.43

Congratulations

 
olyakish:

Still wrote a martin (ilan) under mt5 with dual direction (can trade both ways at the same time)

Here's a test of two pairs at once

Still with glitches - I am fixing them.

Expert Advisor: Exp_Ilan
Symbol: EURUSD
Period: M1 (2012.01.01 - 2012.07.08)
Input parameters:
Broker: Alpari FS
Currency: USD
Initial deposit: 10 000.00
Leverage: 1:100

Results:
Story quality: 99%
Bars: 189115 Tiki: 753399 Characters: 2
Net profit: 7 030.94 Absolute drawdown on balance sheet: 23.53 Absolute drawdown on funds: 2 896.27
Total profit: 9 798.48 Maximum drawdown on balance: 221.95 (1.74%) Maximum drawdown of funds: 3 015.16 (29.80%)
Total loss: -2 767.54 Relative drawdown on balance: 1.74% (221.95) Relative drawdown on funds: 29.80% (3 015.16)

Profitability: 3.54 Expected payoff: 1.27 Margin Level: 169.30%
Recovery Factor: 2.33 Sharpe Ratio: 0.10 Z-score: -28.82 (99.74%)
AHPR: 1.00 (0.01%) LR Correlation: 1.00 OnTester Result: 0
GHPR: 1.00 (0.01%) LR Standard Error: 129.48


Total trades: 5547 Short trades (% of winners): 2576 (68.28%) Long trades (% wins): 2971 (67.79%)
Total trades: 13151 Profitable trades (% of all trades): 3773 (68.02%) Loss trades (% of all trades) 1774 (31.98%)

Largest profitable trade 474.29 Largest losing trade: -7.26

Average profitable trade: 2.60 Average losing trade: -1.56

Maximum number of continuous wins (profit): 51 (54.34) Maximum number of continuous losses (loss): 41 (-119.35)

Maximum number of continuous profits (number of wins): 538.78 (4) Maximum continuous loss (number of losses): -119.35 (41)

Average continuous winnings: 5 Average Continuous Losses: 2



Cool!

 
YOUNGA:

Your version is more elegant and the results are the same

Well then a spoonful of tar - a very small MO (0.77) does not scare you?

All lied - rushed (You have the lot set up artistically) normal MO=7.43

Congratulations

We need to come up with some clever dynamic stop loss calculation, got any ideas or developments in that direction?
 
BeerGod:
I should also come up with a clever dynamic calculation of stop loss, any ideas or developments in this direction?

Yes. There is - for example, depending on the value of ATR with the possibility of optimisation... I can lay out a piece of code...

Took it from a branch Avalanche on the recommendation of the Legendary John Katana himself ... :-)

 

The yen, gold, silver, euro pound pairs have a different dependence on APR, so it is calculated using a different formula (you have to look it up).

The name of the variable here stop-loss is conditional, since this is my variant of a NETTING Avalanche, i.e. there is one order in the market at a time, and it is when the stop is triggered that the position is reversed on increased volumes.

This is how it is implemented in my code:

// Внешние переменные (оптимизируются)
...
extern double StopLoss = 0;       // Стоплосс в пипсах - для пятизнака для йены, золота, серебра...
int TakeProfitPips = 0;           // Тейкпрофит в пипсах 

extern int Period_ATR = 30;       // значение АТР для расчета динамического канала
extern int Mul_TP = 4.0;          // целевая прибыль в единицах волатильности (АТР)
extern double Mul_Sl = 0.8;       // защитная остановка с последующим переворотом при ее сработке уже 
                                  // увеличенным лотом в единицах волатильности (АТР)
...
double channel;
double  StopLossPips;
...
  
int start()    // -----------------------СТАРТ ЭКСПЕРТА--------------- 
{
 ...
    
    //-----------------------------------------------------считаем динамический канал----------------------------
    
    if (Symbol() == "GBPJPY" || Symbol() == "EURJPY" || Symbol() == "USDJPY" || Symbol() == "CHFJPY" ||  Symbol() == "NZDJPY" ||
        Symbol() == "XAUUSD" || Symbol() == "XAGUSD" || Symbol() == "EURGBP")   StopLossPips = StopLoss; // т.к. зависимость по АТР другая (НАДО СМОТРЕТЬ!!!)
              else
               {                 
                  channel = 10* (iATR(Symbol(),PERIOD_D1,Period_ATR,1)*10000/3)*Mul_Sl;                 
                  StopLossPips = NormalizeDouble(channel,0);                                                                                                         
                  //Print ("StopLossPips = ", StopLossPips);
               }               
    TakeProfitPips=NormalizeDouble(StopLossPips*Mul_TP,0);  // расчет уровня тейка для всех инструментов       
... 
 
And how does average candle size on D1 affect the target profit?
 
YOUNGA:
And how does the average size of a candle on D1 affect the target profit?

Because if the volatility is high on the daily, then you can take more profit. If the volatility is low, then less... Because if you don't take a smaller one now (after optimizing these parameters), then later lots may get even larger when prices turn...

 
Everything depends on the spread and commission
 
YOUNGA:
Everything depends on the spread and commission

Let's also look at them and take them into account... Who's stopping us?

Initially - I took the TR calculation from ATR from issue 35 of Fortrader magazine, page 48. 48:



Reason: