[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 765

 

i need prices for pending orders from stops and i used to use pending orders like this

PRAskL=Ask-Point*TakeProfit+Spread;  // цена OpenBuyLimitOrder
PRAskS=Ask+Point*TakeProfit+Spread;  // цена OpenBuyStopOrder
PRBidL=Bid+Point*TakeProfit-Spread;  // цена OpenSellLimitOrder
PRBidS=Bid-Point*TakeProfit-Spread;  // цена OpenSellStopOrder

где 
TakeProfit - глобальная переменая и грубо говоря ее значение постояно
Spread - временая переменая,



но мне не удобно брать цену через рынок и решил напрямую вот так
for(int h=1; h<=OrdersTotal(); h++)         
{if (OrderSelect(h-1,SELECT_BY_POS)==true)   
int Tip=OrderType();                   
if(HaveBuyOrder == true)continue; 
double PRAskS=OrderStopLoss();                   
double PRAskL=OrderTakeProfit();                    
int Tip1=OrderType();                           
if(HaveSellOrder == true)continue; 
double PRBidS=OrderStopLoss();                   
double PRBidL=OrderTakeProfit();   

но оно выдает ошибки 
Ошибка № 4107 при открытиии SELL ордера 
invalid takeprofit for OrderSend function

Ошибка № 4107 при открытиии BUY ордера              
invalid takeprofit for OrderSend function

i need a stop and a yen price and i need to take the spreads into account

 
FoxUA:

i need prices for pending orders from stops and i used to use pending orders like this

how do i solve this problem, i should be able to take yen at stops and ik profits and at the same time i should also take into account spreads

Andrei, here we go again, too little code, you have an error in the function OrderSend, while we cannot see it or its parameters in this code section. Do you want to place pending orders based on stop-losses and take-profits of already existing market orders?

 
ToLik_SRGV:

Andrei, again, too little code, you have an error in the function OrderSend, and we don't see it or its parameters in this part of the code. Do you want to place pending orders based on the data of stop-losses and take-profits of the already existing market orders?

Yes, that's right, put pending orders based on the data of stop-losses and take-profits of existing market orders

the whole code is too big, it is an example of how it worked for me and what I tried to do but it is not right, what would be right for me?

 

i have a rules based example it opens but only one order, i.e. sell

i.e. for all 4 pending orders i.e. opening price at buy loss and sell loss as well as buy stop and sell stop are the same,

I want a buy limit to open at once at close, e.g. buy on stop,

GBPJPY,H1: SELL order opened : 137.16
GBPJPY,H1: open #3897394 sell limit 0.30 GBPJPY at 137.16 sl: 138.36 tp: 135.96 ok
GBPJPY,H1: SELL order opened : 134.76
GBPJPY,H1: open #3897393 sell stop 0.10 GBPJPY at 134.76 sl: 135.96 tp: 133.56 ok
GBPJPY,H1: BUY order opened : 134.76
GBPJPY,H1: open #3897392 buy limit 0.30 GBPJPY at 134.76 sl: 133.56 tp: 135.96 ok
GBPJPY,H1: BUY order opened : 137.16
GBPJPY,H1: open #3897391 buy stop 0.10 GBPJPY at 137.16 sl: 135.96 tp: 138.36 ok
GBPJPY,H1: SELL order opened : 135.96
GBPJPY,H1: open #3897390 sell 0.10 GBPJPY at 135.96 sl: 137.16 tp: 134.76 ok
GBPJPY,H1: BUY order opened : 136.04
GBPJPY,H1: open #3897389 buy 0.10 GBPJPY at 136.04 sl: 134.84 tp: 137.24 ok
GBPJPY,H1: initialized
GBPJPY,H1 inputs: StopLoss=120; TakeProfit=120; Lot=0.1; Magic=777; Slippage=5;
GBPJPY,H1: loaded successfully

for(int o=1; o<=OrdersTotal(); o++)                                   
{if (OrderSelect(o-1,SELECT_BY_POS)==true)                               
{ if (OrderSymbol()!= Curr_symb) continue;                          
  if (OrderType()>1) continue;      
{if(HaveBuyOrder == true) 
double PRAskL=OrderStopLoss();                   
double PRAskS=OrderTakeProfit();      
{                   
int Tip1=OrderType();                         
if(HaveSellOrder == true)
double PRBidL=OrderStopLoss();                   
double PRBidS=OrderTakeProfit(); } }                  
} }              
 
hedger:

Help me figure it out.

On the chart that can be opened in the tester after testing is completed, the indicators on which the EA is based are not always drawn. Can this be fixed and if so, how? Answer me, please

Maybe there is an answer to my question?
 
hedger:

Perhaps there is an answer to my question?

void HideTestIndicators( bool hide)
The function sets flag to hide indicators called by the Expert Advisor. When the chart is opened after the test, the indicators marked with the hide flag will not be displayed in the test chart. Indicators will be flagged with the current hiding flag before each call.
It must be noted that only those indicators that are directly called from the expert under test can be shown in the testing chart.
 
zhuki:

void HideTestIndicators( bool hide)
The function sets flag to hide indicators called by the Expert Advisor. When the chart is opened after the test, the indicators marked with the hide flag will not be displayed in the test chart. Indicators will be flagged with the current hiding flag before each call.
It should be noted that only those indicators that are directly called from the Expert Advisor under test can be shown in the testing chart.

Thank you, Igor! I had to learn the basics blindly.
 

so does anyone know how to fix the above code to set the value of variables like this

PRAskL=StopLoss of order Buy + Spread
PRAskS=TakeProfit of order Buy + Spread
PRBidL=StopLoss Sell-Spread orders
PRBidS=TakeProfit Sell-Spread orders

 
FoxUA:

so does anyone know how to fix the above code to set the values of variables like this

PRAskL=StopLoss orders Buy + Spread
PRAskS=TakeProfit orders Buy + Spread
PRBidL=StopLoss orders Sell-Spread
PRBidS=TakeProfit orders Sell-Spread

If you have errors related to wrong stops, then do a check on the size of stop levels; use them to check pending orders as well - you can't put less than that...

For example:

double Level_stop=MarketInfo(Symbol(),MODE_STOPLEVEL ); //Minimum stop setting distance

 
artmedia70:

If you have errors related to wrong stops, then do a check on the size of stop levels; use them to check pending orders as well - no less is allowed...

For example:

double Level_stop=MarketInfo(Symbol(),MODE_STOPLEVEL ); //minimal stop setting distance


the last one opens without errors, but it only opens with Sell data. it's a clipping from the log and that's not the correct price distribution I described.

Here they are.

PRAskL=StopLoss Buy + Spread orders
PRAskS=TakeProfit of Buy + Spread orders
PRBidL=StopLoss Sell-Spread orders
PRBidS=TakeProfit Sell-Spread orders

this is how it looks like now

PRAskL=StopLoss Sell order

PRAskS=TakeProfit Sell orders

PRBidL=StopLoss Sell order

PRBidS=TakeProfit Sell order

Reason: