[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 827

 

I just read a textbook the other day. I'm taking my first steps and of course I stumble. I'm stumped by this text...

double k = WindowPriceOnDropped( );
if (Ask >= k >= Bid)
{
Alert("You're pressing the wrong button");
return;
}

In theory, if the script is thrown between Ask and Bid, the body of the if statement should be executed, but it's not.

Is there an explanation? Or maybe I'm just overheated?

 
andrjuhara:

.

double k = WindowPriceOnDropped( );
  if (Ask >= k && k>= Bid)
{
Alert("Ты не туда жмешь");
return;
}

 
Thank you.
 

Good afternoon.

Could you please tell me how to draw an arbitrary line segment based on two coordinates ( time1,price1,time2,price2 )? I want a line segment, not a trend line. Horizontal or vertical lines can be plotted using a rectangle as the basis, an arbitrary line can be plotted using a triangle, but I want to draw a line segment, like a human being.

 
 
Thank you. I see.
 
artmedia70:

Thank you!
 

I would like to clarify one question - it is about opening a Stop order. In the simple case (Spread not taken into account):

Buy:

OrderSend(Symbol(), OP_BUYSTOP, Lots, OpenPrice, Slippage, OpenPrice-StopLoss, OpenPrice+TakeProfit, ...)

Sell:

OrderSend(Symbol(), OP_SELLSTOP, Lots, OpenPrice, Slippage, OpenPrice+StopLoss, OpenPrice-TakeProfit, ...)

.

But since Buy is triggered by Ask and Sell by Bid, Spread should be considered.

- Please change these lines to include the Spread.

 
chief2000:

I would like to clarify one question - it is about opening a Stop order. In the simple case (Spread not taken into account):

Buy:

Sell:

.

But since Buy is triggered by Ask and Sell by Bid, Spread should be considered.

- Please change these lines to include the Spread.

For BuyStop, its opening price should be read from Ask, for SellStop from Bid. That's all.

I.e., if we set BuyStop, OpenPrice should be = MarketInfo(Symbol(), MODE_ASK + Order_set_range);

If SellStop, then MarketInfo(Symbol(), MODE_BID - Order_setting_range);

 
artmedia70:
For a BuyStop, its open price should be calculated from Ask, for a SellStop, from Bid. That's all.

I.e., if we set BuyStop, OpenPrice should be = MarketInfo(Symbol(), MODE_ASK + Order_setting_range);

If SellStop, then MarketInfo(Symbol(), MODE_BID - Order_setting_range);

Not quite - for a Stop order, the opening price may be, for example, in the case of Buy,

maximum of the previous fractal (=OpenPrice) + Spread

(provided that the Ask is lower than the fractal by the Stop_Level or more). I.e., the order is placed not on the Ask, but on some "external" condition.

But more to the point I would like to know about accounting for Spread in TakeProfit and StopLoss:

- In the case of Buy:

OrderSend(Symbol (), OP_BUYSTOP, Lots, OpenPrice+Spread, Slippage, OpenPrice-StopLoss, OpenPrice+TakeProfit+Spread, ...)

- Sell:

OrderSend(Symbol(), OP_SELLSTOP, Lots, OpenPrice, Slippage, OpenPrice+StopLoss+Spread, OpenPrice-TakeProfit, ...)

- Correct or am I missing something?

Reason: