How to code? - page 65

 
wolfe:
Is there a way to code this include function so there is NO chance that it will get "stuck" in it's loop?
int CBM(int intMagic)//CloseByMagic

{

int intOffset=0;

int Count = OTBM(intMagic);

while(OTBM(intMagic)>0 && Count > 0)

{

OrderSelect(intOffset,SELECT_BY_POS);

if(OrderMagicNumber()==intMagic)

{

if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),999,Red);

else if(OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),999,Orange);

Count--;

}

else {

intOffset++;

}

}

return(0);

}
Thanks to anyone who can help.

Something simple like this should work.

 
omelette:
Something simple like this should work.

Thank you once again Omelette! You have saved me again from beating my head against the wall.

Your help has been priceless.

 

Missing an indicator bar...

Hi guys...

Wondering if you would have any idea why when using an indicator that displays as an histogram bar...now and then it does not display a bar...even though there should be one there. It worked on previous bars as they occurred and following bars and when the indicator is put on a new chart the missing bar is shown on it...Also fixes itself if you re-compile the indicator...

the indicator is very straight forward like a momentum style indicator just counting bars ...with a calculation at the end..using ...iclose ,iopen and such.

just weird that it messes a bar...

 

Gidday

What does this mean. I have compiled it and the only error I get is this but can't find any info on it. any help would be good.

"comparison expression expected"

Cheers Beno

 
Beno:
Gidday

What does this mean. I have compiled it and the only error I get is this but can't find any info on it. any help would be good.

"comparison expression expected"

Cheers Beno

You probably used '=' instead of '=='

 

Changing values without chaging shape of an indicator

Hi,

I have the following programming problem: I have an indicator and I would like to change it so that it moves between -2 and 2. The current range is way smaller so simply putting a fixed minimum and fixed maximum in it does not work. I need to change the actual values of the indicator. Does anyone know how to do this? Help would be much appreciated..

cheers

 

pip-based timeframe

how would you code a chart that is based on pips and not on time, but on pips: a candle closes when you've had 10 pips up or 10 pips down. So candles(/bars) are based on price and not on time.

Doesn't seem like a simple coding thing so any help would be much appreciated

 
MrM:
how would you code a chart that is based on pips and not on time, but on pips: a candle closes when you've had 10 pips up or 10 pips down. So candles(/bars) are based on price and not on time. Doesn't seem like a simple coding thing so any help would be much appreciated

Do some search for "Renko"

 
MrM:
Hi,

I have the following programming problem: I have an indicator and I would like to change it so that it moves between -2 and 2. The current range is way smaller so simply putting a fixed minimum and fixed maximum in it does not work. I need to change the actual values of the indicator. Does anyone know how to do this? Help would be much appreciated..

cheers

old value: v0 in the range min0...max0

new value: v1 in the range min1...max1

linear transformation: (v0-min0)/(max0-min0)=(v1-min1)/(max1-min1)

=> v1=min1+(max1-min1)*(v0-min0)/(max0-min0)

 

Multiple Orders

I never quite understood the concept behind multiple orders.

What I'm trying to code here is a system which open 5 separate lots, and then closes them individually as each lot reaches their respective TP.

I know it's possible, how do I do it?

Reason: