[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 26

 
yosuf:
My EA sets orders on the signal of the indicator, and if the indicator gives a signal to re-set an existing order, for example with 0.1 lot, then the EA sets one more order which is identical to the existing order, which makes the number of orders increase unreasonably. Question: How to make the EA simply increase the lot size of the existing order in such cases? Is such a modification possible in principle?

You can try the opposite: at the first signal you open a lot with the maximum possible volume and then, if the signal disappears, you start to close this order partially.
 
Am I stupid or what? I am playing with an EA. Under certain conditions (I do not change it) it opens positions up or down. Take Profit and Stop Loss at 30 pips. If I draw a Sell position, in these conditions I open a Sell position and vice versa, respectively, change the direction of stops and it goes bust again. What is the trick? I have already lost my head. Maybe this spread influences something? Or more precisely, what BUY opens by Ask and SELL by Bid?
 
Good evening. I decided to study MQL for myself, so I could write (edit) an Expert Advisor myself. I've read the corresponding literature, but it is very difficult for a person (i.e. me) who is not familiar with programming to understand it right away. Of course, a whole bunch of questions arose right away. May be, I will ask them once again, please forgive me for this! I am interested in the following nuance: let's say an order (BUY) is opened with Stoploss and TakeProfit already placed. At the moment when the stop on the first order triggered, the second order ( at the closing price of the first order) opens again with the Stoploss and TakeProfit set. I.e., if Stoploss on order №1 opens order №2, if TakeProfit of order №1 triggers, then order №3 opens? If possible, I would like to see how the code of such an EA looks like!
 
dikson1976-1:
Am I stupid or what? I am playing with an EA. Under certain conditions (I do not change it) it opens positions up or down. Take Profit and Stop Loss at 30 pips. If I draw a Sell position, in these conditions I open a Sell position and vice versa, respectively, change the direction of stops and it goes bust again. What is the trick? I have already lost my head. Maybe this spread influences something? Or more precisely, what BUY opens by Ask and SELL by Bid?
I also thought at the beginning that if my Expert Advisor sells too much, just reverse buying and selling and everything will be OK. Spread has an impact 100-percent.
 
paladin80:
In the beginning I also thought that if an EA was losing money it would be enough to reverse the buy and sell and everything would be OK. The spread has a 100 per cent effect.
You have to lose more than 2 spreads. Then it will make profit on reversal.
 
Reshetov:
iClose()
If I need a more accurate price, i.e. the current Bid for another instrument, what should I do?
 

T-G:
and if I need a more accurate price i.e. the current Bid for another instrument what should I do?

That's the only way to get a price on another tool

eurbid = MarketInfo("EURUSD",MODE_BID);
Only the tester in MT4 will not work with more than one instrument.


 
evillive:

This is the only way to get a price for another tool

Only the tester will not work with more than one instrument in MT4.


I understand, but I need to use EURUSD and get GBPUSD on Demo or Real.

Bid = MarketInfo("GBPUSD",MODE_BID);

What can I do if I want to get a different instrument price?

 
T-G:

I understand, but I need to use EURUSD and get GBPUSD on Demo or Real.

What can I do if I want to get another symbol price when testing?

Bid = MarketInfo("GBPUSD",MODE_BID); 

EURUSD and get GBPUSD on Demo or Live......?

Bid = Last known bid/ask price of the current symbol

You need for example:

iBid = MarketInfo("GBPUSD",MODE_BID);
 
r772ra:

EURUSD and get with GBPUSD on demo or real work......?

Bid = Last known bid/ask price of the current symbol

You need for example:

When I test it in the tester , I need to get a price of another instrument.

Bid = MarketInfo("GBPUSD",MODE_BID); 

it does not work in the tester (although the demo and real give the price of another instrument) my question is how come in testing on the euro and get the pound price. iClose is rough.

Reason: