Show your code please (use button).
:)
You cannot control the price! For example, you have a 'BUY' position at a price of 100. Now the price is '50'. If you wish to close a position at the moment, you will close that position at the price of '50'. This is clear?
:)
You cannot control the price! For example, you have a 'BUY' position at a price of 100. Now the price is '50'. If you wish to close a position at the moment, you will close that position at the price of '50'. This is clear
extample 3 open trade on 50,100,200 then current price come on 50 then close all trade
i want its FirstTradePrice
double LastTradePrice(int direction) { double result = 0; for(int i = PositionsTotal()-1; i >= 0; i--) { if(PositionGetTicket(i) <= 0) continue; if(PositionGetInteger(POSITION_TYPE) > 1) continue; if((direction < 0 && PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) || (direction > 0 && PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL)) continue; if(PositionGetString(POSITION_SYMBOL) == Symbol() && PositionGetInteger(POSITION_MAGIC) == MagicNumber) { result = PositionGetDouble(POSITION_PRICE_OPEN); break; } }
Hello
i use grid system
between 2 trade gap is randomly
so i want close all condition on my first open trade price
when above 1 trade are open
Like 1 no trade profit 0
2 no trade profit 1
3 no trade profit 3
4 no trade profit 9
plz help me
How interesting no trade profit 9.
first trade on price 50
second trade on price 100
third trade on price 200
then price go down and hit the price of 50 then close all trade third trade profit 150 second trade profit 100 and first one trade profit 0 then close
Grid sirMy algorithm is as follows: we go through all the positions and look at the position opening time, at the same time we save the position price.
//+------------------------------------------------------------------+ //| Calculate all positions | //+------------------------------------------------------------------+ void CalculateAllPositions(double &buy_price,double &sell_price) { buy_price = 0.0; sell_price = 0.0; datetime buy_time = D'2090.01.01'; datetime sell_time = D'2090.01.01'; for(int i=PositionsTotal()-1; i>=0; i--) if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties if(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==InpMagic) { if(m_position.PositionType()==POSITION_TYPE_BUY) { if(m_position.Time()<buy_time) { buy_price=m_position.PriceOpen(); buy_time=m_position.Time(); } } else { if(m_position.Time()<sell_time) { sell_time=m_position.PriceOpen(); sell_price=m_position.Time(); } } } }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
i use grid system
between 2 trade gap is randomly
so i want close all condition on my first open trade price
when above 1 trade are open
Like 1 no trade profit 0
2 no trade profit 1
3 no trade profit 3
4 no trade profit 9
plz help me
Example if 5 order open then