How to start with MQL5 - page 20

 
Hello, friends
I have a problem with overnight swaps
I need a robot to remove my stop loss at 00:45 (broker time) and return my stop loss at 14:15.
I need this Expert Advisor for MetaTrader 5.
If anyone uses this expert or can write one, let me know

***

 
ashkan1366 :
Hello, friends
I have a problem with overnight swaps
I need a robot to remove my stop loss at 00:45 (broker time) and return my stop loss at 14:15.
I need this Expert Advisor for MetaTrader 5.
If anyone uses this expert or can write one, let me know

***

1. It is not clear why such a time? Is it trading time?

2. Didn't you think that after you remove the SL the price can go away a lot and the SL can no longer be set (more precisely, if you set it, the SL will work instantly)?

 
ashkan1366:
Hello, friends
I have a problem with overnight swaps
I need a robot to remove my stop loss at 00:45 (broker time) and return my stop loss at 14:15.

How does removing the stop loss help with your problem with swaps??

 

Vladimir Karputov:

1. It is not clear why such a time? Is it trading time?

2. Didn't you think that after you remove the SL the price can go away a lot and the SL can no longer be set (more precisely, if you set it, the SL will work instantly)?

Between 01:00 pm and 02:00 pm, due to interbank calculations, the spreads multiply significantly and the possibility of dealing with stop loss increases.

For this reason, remove the stop loss for an hour and get back to the previous place.

There is no need to worry about the price reaching normal in Stop Loss according to my strategy.

 
ashkan1366 :

Between 01:00 pm and 02:00 pm, due to interbank calculations, the spreads multiply significantly and the possibility of dealing with stop loss increases.

For this reason, remove the stop loss for an hour and get back to the previous place.

There is no need to worry about the price reaching normal in Stop Loss according to my strategy.

You previously talked about swaps, and now about spreads. Can you decide exactly?


Added.

In general, I get it. I propose to make a structure ( Structures, Classes and Interfaces ) - this structure will store three fields:

  • position ticket
  • item type
  • and size SL

In the evening we go through all the positions and fill in the structure. After that, we reset all SL positions to zero. In the morning we go around all positions and restore SL from the structure.

This is a sketch, I will show the implementation a little later ...

Documentation on MQL5: Language Basics / Data Types / Structures, Classes and Interfaces
Documentation on MQL5: Language Basics / Data Types / Structures, Classes and Interfaces
  • www.mql5.com
Structures, Classes and Interfaces - Data Types - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Vladimir Karputov:

You previously talked about swaps, and now about spreads. Can you decide exactly?


Added.

In general, I get it. I propose to make a structure ( Structures, Classes and Interfaces ) - this structure will store three fields:

  • position ticket
  • item type
  • and size SL

In the evening we go through all the positions and fill in the structure. After that, we reset all SL positions to zero. In the morning we go around all positions and restore SL from the structure.

This is a sketch, I will show the implementation a little later ...

True, I mean nightly spreads.
Thanks for your tips.
 
Vladimir Karputov:

No, you did not understand me. I asked: "What type of your TRADING ACCOUNT: netting and hedge"?

I understand what you mean.
I do not have a real account on MT5 yet. Having a real account on MT5 with a broker requires whether I can rewrite my EA in MT5 with the same precision and finesse as MT4, or not?


So there is not much difference between netting or hedging with a demo account for me.


I definitely don't want to do hedge with my EA. I just want to be free to open any position at any distance from the previous positions, and keep positions open independently so that I can close them myself.

Would you please tell me which netting account is better for my request or a hedging account?

 
RZAMK :

I understand what you mean.
I do not have a real account on MT5 yet. Having a real account on MT5 with a broker requires whether I can rewrite my EA in MT5 with the same precision and finesse as MT4, or not?


So there is not much difference between netting or hedging with a demo account for me.


I definitely don't want to do hedge with my EA. I just want to be free to open any position at any distance from the previous positions, and keep positions open independently so that I can close them myself.

Would you please tell me which netting account is better for my request or a hedging account ?

First you must answer the question: "What type of your TRADING ACCOUNT: netting and hedge"? Until you answer - I can't help you with anything

 
RZAMK:
...

So there is not much difference between netting or hedging with a demo account for me.

...

read about netting and hedging in MT5:

MetaTrader 5 Help → Trading Operations → Basic Principles → Position Accounting System

 
Vladimir Karputov:

First you must answer the question: "What type of your TRADING ACCOUNT: netting and hedge"? Until you answer - I can't help you with anything

Whith thanks to Mr Sergey Golubev for his guidance, I choose hedging system, that I can have several open positions at the same time.


But dear Vladimir, I have a problem with this feature of the hedging system, which says :

" A position cannot be reversed in the hedging system. In this case, the current position is closed and a new one with the remaining volume is opened. "

Is there any way to disable it so that I can simultaneously hold open Buy & Sell positions on a currency pair?

Reason: