Stop loss must be above order price(selling)? What if I want it not to be? - page 2

 
Ahmet Metin Yilmaz:
Or use your terminal strings--- symbolinfosample
How do I do this?

I created symbolinfosample based as https://github.com/zephyrrr/MLEA/blob/master/MQL5/Scripts/Examples/SymbolInfo/SymbolInfoSample.mq5

and imported https://github.com/zephyrrr/MLEA/blob/master/MQL5/Scripts/Examples/SymbolInfo/SymbolInfoSampleInit.mqh into include folder

When I use Strategy Tester I receive this:

2020.05.25 16:52:56.995 MQL5 wrong type, loading of InfoSample failed
2020.05.25 16:52:56.995 Tester loading of C:\Users\jpaca\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Experts\InfoSample.ex5 failed
2020.05.25 16:53:05.003 Tester Experts\InfoSample.ex5 not found

zephyrrr/MLEA
zephyrrr/MLEA
  • zephyrrr
  • github.com
MachineLearning EA. Contribute to zephyrrr/MLEA development by creating an account on GitHub.
 
Drazen Penic:

I forgot to mention - if you are setting stop loss for the sell order, you must use ask price as reference.

You can't set stop loss between bid and ask.

Print("Stop changed, at ask price: "+last_tick.ask+" and last price: "+last_tick.last+" broker's stoplevel is "+SymbolInfoInteger(_Symbol, SYMBOL_TRADE_STOPS_LEVEL));


2020.05.25 17:05:06.805 2019.06.05 11:06:20   Stop changed, at ask price: 97125.0 and last price: 97120.0 broker's stoplevel is 0

2020.05.25 17:05:06.805 2019.06.05 11:06:20   failed modify #4 sell 1 WIN$N sl: 97300, tp: 96945 -> sl: 97216, tp: 96945 [Invalid stops]
2020.05.25 17:05:06.805 2019.06.05 11:06:20   CTrade::OrderSend: modify WIN$N (sl: 97216, tp: 96945) [invalid stops]


Not this problem, I think..

 
aguilera_joao: When I use Strategy Tester I receive this: … Tester Experts\InfoSample.ex5 not found

Compiling it first might help.

 
William Roeder:

Compiling it first might help.

Of course I did it.

 
You should use this script on the chart
Not in the ecpert
 
Ahmet Metin Yilmaz:
You should use this script on the chart
Not in the ecpert

Oh.. there is the result!

Thank you!

Files:
Capturar.PNG  25 kb
 
aguilera_joao:

Oh.. there is the result!

Thank you!

because of trade disabled?

 
Ahmet Metin Yilmaz:

because of trade disabled?

Maybe. I don't know.. Maybe its because market is closed..
In backtesting I can move the Stop loss freely until I reach the entry price.. 
I will try again to find a solution.. If I find it I make a new post here.

Testing trading strategies on real ticks
Testing trading strategies on real ticks
  • www.mql5.com
The article provides the results of testing a simple trading strategy in three modes: " 1 minute OHLC " using only Open, High, Low and Close prices of minute bars; detailed modeling in " Every tick " mode, as well as the most accurate " Every tick based on real ticks " mode applying actual historical data. Comparing the results allows us to...
 
aguilera_joao:

Sorry? this is info about Market at this moment, and I'm backtesting..

Do you want me to enable trade somehow?

Sorry if i misunderstand you, I'm new to programming, and MQL5.

Of course it is market info and i am the Who advised you to use it. 
I Just Wonder What is the problem? 
Then It might be spread! 
 
aguilera_joao:


2020.05.25 17:05:06.805 2019.06.05 11:06:20   Stop changed, at ask price: 97125.0 and last price: 97120.0 broker's stoplevel is 0

2020.05.25 17:05:06.805 2019.06.05 11:06:20   failed modify #4 sell 1 WIN$N sl: 97300, tp: 96945 -> sl: 97216, tp: 96945 [Invalid stops]
2020.05.25 17:05:06.805 2019.06.05 11:06:20   CTrade::OrderSend: modify WIN$N (sl: 97216, tp: 96945) [invalid stops]


Not this problem, I think..

Did you saw this?

Maybe there is an broker's stoplevel that I can't measure with SymbolInfoInteger(_Symbol, SYMBOL_TRADE_STOPS_LEVEL)
Will have to do more tests..

Basic Principles - Trading Operations - MetaTrader 5 Help
Basic Principles - Trading Operations - MetaTrader 5 Help
  • www.metatrader5.com
is an instruction given to a broker to buy or sell a financial instrument. There are two main types of orders: Market and Pending. In addition, there are special Take Profit and Stop Loss levels. is the commercial exchange (buying or selling) of a financial security. Buying is executed at the demand price (Ask), and Sell is performed at the...
Reason: