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

 
alsu:

Take the period_converter script and modify the candlestick clipping condition to your liking, and you'll be happy. For example, at a glance, to get candles for x hours and 10 minutes:

replace with

or something like that)))


Thanks for the genius idea! I tried everything I could think of, but the logic of the script is beyond me.

Hourly candlesticks with coeff=1 are always identical to the original, but the output is close to it :(
if(time0>=i_time+periodseconds && TimeMinute(time0)==10 || i==0)
// и
if(time0>=i_time+periodseconds +60*10 || i==0)
// и
if(TimeMinute(time0)==10 || i==0)
// тоже

How to shift the opening of the hour candle in the Period_converter script by 10 minutes? Do I need to make changes at the stage of recording history?

 
artmedia70:

Eh... I haven't wanted to take alcohol for eight years now - not interested in it... :)

Thanks for caring about your health ;)


You're always welcome.

I don't, and not just any alcohol, but... a lot of other things. I'm an active health scout myself.

 
Operr:


Thanks for the brilliant idea! I tried everything I could think of, but the logic of the script is beyond me.

Clocks with coeff=1 in the offline are always identical to the original, but the output is somewhere near :(

How can I move the opening of the hour candle in the Period_converter script by 10min? Is it necessary to change the history recording step?


hmm... run the script on minutes)
 

Good afternoon,

Could you please tell me how to put a marker on the chart? For example, the order did not open, but at least to see on the chart, at which point it should have opened.

I would like to see on the charts where it was supposed to open.

 
How do I make (if the previous trade was a buy trade) the next one open for sell? Thank you in advance.
 
KoOr:
How do I make (if the previous trade was a buy trade) the next one open for sell? Thank you in advance.
Make a loop through the history. If the type of the last closed position == OP_BUY, then you should open OP_SELL
 

I wrote it down like this, but it still opens for purchase.

OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY);
if(OrdersTotal()==OP_BUY)
if(OrdersTotal()==0)
if(rv1a<rv1b) tiket2=OrderSend(Symbol(),OP_SELL,lot,Bid,3,0,0,NULL,121,0,Red);
 
KoOr:

I wrote it down like this, but it still opens for purchase.

if(OrdersTotal()==OP_BUY)

It says here "if the number of orders is equal to a buy operation". What do you mean?
 

I don't pretend to be an expert, I just started to understand something myself, but this procedure is in almost any CODE BASE advisor !!!!

Declare CloseRevers at the very beginning

extern bool CloseRevers = true;

// This is placed in the check after the signal but before OrderSend

if (CloseRevers) CLOSEORDER(OP_SELL);

if (CloseRevers) CLOSEORDER(OP_BUY);

void CLOSEORDER(int ord)

{

for (int i=0; i<OrdersTotal(); i++)

{

if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) // <-----MODE_HISTORY if the trade has already been closed

{

if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)

{

if (OrderType()==OP_BUY && ord==OP_BUY)

OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),3,CLR_NONE);

if (OrderType()==OP_SELL && ord==OP_SELL)

OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),3,CLR_NONE);

}

}

}

}

Accordingly, if you already have a closed trade, check with MODE_HISTORY (instead of MODE_TRADES)

Hope that helped....

 
I mean, if the previous trade was a buy trade, the next one is a sell trade. Help me get this right. Thank you.
Reason: