Weekend evening - page 38

 
Vladimir Karputov:

Two Trend Line.mq5

version "1.001"


Stop Loss, Take Profit and Trailing are disabled. When opening a position, a comment ("UP" or "DOWN") is added, to understand which line has triggered the signal.

OnTick will show a critical error when going through any line.

 
Here is the error log:
MJ      0       02:48:40.746    Tester  EURUSD,H1 (Alpari-MT5-Demo): generating based on real ticks
JR      0       02:48:40.746    Tester  EURUSD,H1: testing of Experts\Two_Trend_Line.ex5 from 2019.08.01 00:00 to 2019.08.19 00:00 started with inputs:
KR      0       02:48:40.746    Tester    InpStopLoss=0
QF      0       02:48:40.746    Tester    InpTakeProfit=0
PL      0       02:48:40.746    Tester    InpTrailingFrequency=9
IN      0       02:48:40.746    Tester    InpTrailingStop=0
PD      0       02:48:40.746    Tester    InpTrailingStep=5
IR      0       02:48:40.746    Tester    InpLotOrRisk=1
NQ      0       02:48:40.746    Tester    InpVolumeLotOrRisk=0.01
MG      0       02:48:40.746    Tester    InpTrendLineUPName=UP
MP      0       02:48:40.746    Tester    InpTrendLineDOWNName=DOWN
IF      0       02:48:40.746    Tester    InpWorkTimeFrame=0
RL      0       02:48:40.746    Tester    InpOnlyOne=false
DQ      0       02:48:40.746    Tester    InpReverse=false
IE      0       02:48:40.746    Tester    InpCloseOpposite=false
LQ      0       02:48:40.746    Tester    InpPrintLog=false
IF      0       02:48:40.746    Tester    InpMagicUP=312169352
EF      0       02:48:40.746    Tester    InpMagicDOWN=312169353
MO      0       02:48:40.953    Ticks   EURUSD : real ticks begin from 2019.08.01 00:00:00
OI      0       02:48:41.164    History EURUSD,Daily: history cache allocated for 423 bars and contains 410 bars from 2018.01.02 00:00 to 2019.07.31 00:00
DK      0       02:48:41.183    History EURUSD,Daily: history begins from 2018.01.02 00:00
CK      2       02:49:07.469    Two_Trend_Line (EURUSD,H1)      2019.08.01 04:00:00   array out of range in 'Two_Trend_Line.mq5' (1302,69)
RE      2       02:49:07.469    Tester  OnTick critical error
IK      0       02:49:07.475    Tester  EURUSD,H1: 10397 ticks, 5 bars generated. Environment synchronized in 0:00:00.568. Test passed in 0:00:26.980 (including ticks preprocessing 0:00:00.172).
FN      0       02:49:07.475    Tester  EURUSD,H1: total time from login to stop testing 0:00:27.548 (including 0:00:00.568 for history data synchronization)
HR      0       02:49:07.476    Tester  274 Mb memory used including 1.41 Mb of history data, 64 Mb of tick data
 

A mistake somewhere in the choice of money management. When we switch from interest to fixed lot. When interest is left, positions are opened. Apparently I'm just in a hurry. Another thing: positions open with a lag.
Of course, maybe that's how it's supposed to be for now. I'm not racing the horses. I'm just coordinating the course of events.
I'm sorry. if I should have reported the Bid and Ask earlier. The trades should come from them, not the candlesticks.


In the first case, the bot waited for the next candle and opened a Sell immediately with it. But it should have been done as soon as Ask has crossed the Down line from above downwards. The same story with the UP line. When making transactions, the bot should start from the current market price (Ask and Bid), but not from the candlesticks.
The algorithm is as follows: If Ask < the Up or Down line, then SELL. If Bid > the Up or Down line, then BUY. Bid and Ask are not meant in terms of trading, but in terms of condition. Both indicators must cross the line. As soon as it happened, a trade is executed. Opening andclosing of positions should be based on the current price, and not on the OPN and CLSE candlesticks.

 

Two Trend Line.mq5

version "1.002"


Fixed working with risk when setting the lot.


Remind you: Checking the crossover works ONLY at the moment when a new bar is born. Reacting instantly to price crossing is quite dangerous and I don't see the logic in it.


Added:

pay attention to the"Work Time Frame" parameter - this is the one that sets the timeframe at which the new bar is caught. And already on the new bar of the "Work Time Frame" timeframe checks the crossing of price on H1. That is, if the"Work Time Frame" is set to M1, it means that crossing of our lines by the H1 bar will be checked once a minute.

Files:
 
Vladimir Karputov:

Two Trend Line.mq5

version "1.002"


Fixed working with risk when setting the lot.


Remind you: Checking the crossover works ONLY at the moment when a new bar is born. Reacting instantly to price crossing is quite dangerous and I don't see the logic in it.


Added:

pay attention to the"Work Time Frame" parameter - this is the one that sets the timeframe at which the new bar is caught. And already on the new bar of the "Work Time Frame" timeframe checks the crossing of price on H1. That is, if the"Work Time Frame" is set to M1, it means that crossing of our lines by the H1 bar will be checked once a minute.

As an option: to take the check to a faster timeframe, yes. But I would like it to be on Ask and Bid. The trades will be frequent, of course. We will see. Maybe on bars with M1 and even better.
 
Simply, if an order opens far from the line, there is a hole in the trap, through which the deposit escapes
 
problem. UP line has been crossed, but the SELL trade is hanging on. Set it to M1 in the settings
Files:
WTF.jpg  101 kb
 
Rad89:
Problem. UP line is crossed, but SELL trade is hanging on. In the settings I set M1

Full set file with settings please. Template of the chart in the plotted lines. Dates from and to. Symbol and timeframe. Generally two tabs (Natstrokes and Parameters) from the Tester window.

 
Vladimir Karputov:

Full set file with settings please. Chart template with lines drawn. Dates from and to. Symbol and timeframe. Generally two tabs (Natstrokes and Parameters) from the Tester window.

There is no problem with lines. Put them anywhere on the chart and they are automatically put where they should be on the new day. It's with them that everything is clear, all right. The problem is in the lag of working with orders.
I have not changed anything in settings other than timeframe and lot. I have called the lines as they should be. Everything is OK with lines. They fit on the chart like clockwork.

Files:
1.jpg  60 kb
2.jpg  145 kb
 
Vladimir Karputov:

Full set file with settings please. Chart template with lines drawn. Dates from and to. Symbol and timeframe. Generally two tabs (Natstrokes and Parameters) from the Tester window.

I will only be able to record a video in the evening, if not decided by that time. I will directly show the points where the bot misses.