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

 

Good evening all!

I need to code the following algorithm.

Put a SELLSTOP pending order at the opening of a zero candle

ONLY if there is no SELLSTOP already placed on that candlestick.

That is, on one zero candle to put one SELLSTOP ... and no more.

I successfully implemented this idea of an SELL order in this code

===========================================================

int last_order_bar = 0;
int ot = OrdersTotal();

if (ot>0) //if there are orders in the market (both market and TARGET)

if (OrderSelect (ot-1,SELECT_BY_POS)) //elect the last order
if ( OrderType ()==OP_SELL) //if this is an open SELL market order

last_order_bar = iBarShift (Symbol (),0,OrderOpenTime ())//remember the sequence N of the candle in which this market order SELL was opened

(ot==0 || last_order_bar>0) //if no order is opened or if the last order is not on the current bar

if( Bid ==iOpen (Symbol (),0,0))//if price = open price of the bar

//open order

I cannot apply this algorithm to pending orders because the OrderOpenTime () as iBarShift ( ) parameter, if I am not mistaken, returns only the open time of a market order,

not a pending one.

Could you please pass the time of placing a pending order as a parameter to iBarShift ( )?

Or how else can I implement what I want?

Thank you.

 
solnce600:

Could you please pass the time of pending order opening as a parameter to iBarShift ( )?

After opening a pending order, save the time it was opened in a global variable,

make a ticket in the variable name to differentiate one variable from another

+ control closed/deleted pending orders to clear variables from memory.
 
sergeev:

after opening a pending order, save its open time in a global variable,

put a ticket in the variable name, to distinguish one variable from a pending order from another

+ monitor closed/deleted pending orders to clear variables from memory.

And what function returns the open time of the last pending order?

For example, as applied to a market order, it is clear that OrderOpenTime () returns the time of the last market order opening?

Or, the time of opening of a pending order can be saved without using the function?

If it is so, I would be very grateful to you if you could show me in the code how it is done?

Thank you very much for your prompt reply.

 
solnce600:

Which function returns the opening time of the last pending order?

In your case - you need to save Time[0]
 
sergeev:
in your case - you need to save Time[0]

OK. Thank you.
 

Hi all!

I'm writing some kind of indication, which would use signals from RSIOMA, but I can't get the necessary values of marsiomaXupSig and marsiomaXdnSig buffers. The RSIOMA code has the following lines SetIndexBuffer(6,marsiomaXupSig); SetIndexBuffer(7,marsiomaXdnSig);"...." if(RSIBuffer[i+1]<=marsioma[i+1]&&RSIBuffer[i]>marsioma[i]) marsiomaXupSig[i] = -11; if(RSIBuffer[i+1]>=marsioma[i+1]&&RSIBuffer[i]<marsioma[i]) marsiomaXdnSig[i] = 11; I try to get data in my indicator as follows

double marsiomaXupSig = iCustom(NULL, Period(), "RSIOMA_v3",RSIOMA,RSIOMA_MODE,RSIOMA_PRICE,Ma_RSIOMA,Ma_RSIOMA_MODE,BuyTrigger,SellTrigger,BuyTriggerColor,SellTriggerColor,MainTrendLong,MainTrendShort,MainTrendLongColor,MainTrendShortColor,MajorTrend,marsiomaXupSigColor,marsiomaXdnSigColor,BarsToCount,6,0);

double marsiomaXdnSig = iCustom(NULL, Period(), "RSIOMA_v3",RSIOMA,RSIOMA_MODE,RSIOMA_PRICE,Ma_RSIOMA,Ma_RSIOMA_MODE,BuyTrigger,SellTrigger,BuyTriggerColor,SellTriggerColor,MainTrendLong,MainTrendShort,MainTrendLongColor,MainTrendShortColor,MajorTrend,marsiomaXupSigColor,marsiomaXdnSigColor,BarsToCount,7,0);

Logically I should have gotten values 11 and -11 , but when I log the values I get only 2013.05.28 09:05:52 2013.01.04 11:29 my EA XAUUSD,H1: marsiomaXdnSig - 2147483647 2013.05.28 09:05:52 2013.01.04 11:29 my EA XAUUSD,H1: marsiomaXupSig - 2147483647 What am I doing wrong ?


 

Good afternoon! I started making up a function for some reason, and here, a bunch of mistakes... It seems to be correct, I've been looking at it for 15-20 minutes.

RasstawimOrdera(int Raz,double Dist_pervaya,double Dist_dalshaya,double TP, double SL,double Lot) ................

'RasstawimOrdera' - expression on global scope not allowed C:\Documents and Settings\User\My Documents\FxClub\TeleTRADE\experts\Square.mq4 (73, 1)

'Raz' - variable already defined C:\Documents and Settings\User\My Documents\FxClub\TeleTRADE\experts\Snap.mq4 (73, 21)

'double' - variable expected C:\Documents and Settings\User\FxClub\FieldClub\eleTrade\experts\Speaker.mq4 (73, 25)

'Dist_pervaya' - expression on global scope not allowed C:\Documents and Settings\User\My Documents\FxClub\TeleTRADE\experts\Spline.mq4 (73, 32)
'Dist_pervaya' - variable not defined C:\Documents and Settings\User\My Documents\FxClub\TeleTRADE\experts\Square.mq4 (73, 32)

And so on,




It is glitchy. Forum. When I reply to press the space bar, cursor is trembling and running one step forward and backward, spontaneously jumping to the top left corner. I press the left touchpad to the place where I want to continue writing-no, the cursor keeps flashing at the beginning of the text, and paints it blue and back. It took another 10 minutes to scold me.

I wrote it in notepad and copied it.

So, I understand that there may be a dot missing there, for example me, or some nonsense, but I don't get it. Please give me a hint!

 
I think I've already figured it out. Who thought with me, THANK YOU!!!
 
What kind of RSIOMA is it? Then, check very carefully everything you put in the function, I so already can't remember where it has what . Better yet, print out the prints!
 

No... Of course, I've now declared the function to be int... But now...

'errorcomment' - expression on global scope not allowed C:\Documents and Settings\User\My Documents\FxClub\TeleTRADE\experts\Contructor.mq4 (80, 11)

What is it, where do I look?

Reason: