Ask! - page 161

 

Open Reversal Trade after StopLoss

Hello Master Coders,

Could you please teach me how to make code to open a reversal order after the previous order hit StopLoss?

For example:

First it open a BUY order with xx Stoploss, then when the price hit the SL, it immediately open a new SELL order at the (BUY) Stoploss price.

This should work with ECN broker since hedging is not allowed.

Thanks & Regards

 

Risk Calculation EA

I've been working on code to decide how many lots to purchase with an EA. It's pretty much complete, the main part is

double LotsToOpen(double riskLevel, double ticksToRisk)

What I'd like to solve is how to find the ticks in a pip - where the answer is usually 10 on a fractional lot system, and I use the 'old' definition of a pip, ie, $10 on a lot of EURUSD, or what is usually a single digit change on the 5th significant digit of the quote.

double TicksInOnePip()

{ // there should be a programatic way to get this for an account.

// shouldn't have to rely on user input.

return(TicksInAPip);

}

Any thoughts, ideas on how to program this to work with all currency pairs?

Files:
 

Display Comments To See Color Changes In Buffers

Yellowbeard;

Can someone tell me what I'm doing wrong? Can someone show me how to capture the point when one color changes to another?

Thanks!

---

Hi Yellowbeard,

---

Alert: LSMA5 = 2147483647.00000000

* This indicates an "empty buffer"...not getting values. You should not need these extra buffers to find the color change. See below.

---

To display the values of the LSMA buffers and match them to color changes - Add these Comments to your LSMA code :

Comment (

"\n ExtMapBuffer1[shift]", ExtMapBuffer1[shift]

"\n ExtMapBuffer2[shift]", ExtMapBuffer2[shift]

"\n ExtMapBuffer3[shift]", ExtMapBuffer3[shift]

"\n ",

"\n " ) ;

Re-Compile it when you are done.

Use Strategy Tester - run any EA and place your LSMA indicator on the chart. Run STester really really slow and watch the buffer values change as the colors change.

Hope this helps,

Robert

 

Show value of the momentum??

Hi, can somone please show me how to show the value of

the momentum on the screen without the having the indicator

on screen?

Thanks in advance!

Regards, halvard

 

How can I set an if statement in the declare area of the indicator, something like

extern int TS=30; //trailing stop

and include

if(Digits==2||Digits==4) PF=1; else PF=10;

to set digits automatically?

 

You'd have the variable PF outside the init function and put your code to initialize PF inside the init function.

Also try to use braces more in your if statements. It makes it much easier to follow and when you get bugs it's easier to track them down.

if(xxx){

zzz

}else{

yyy

}

Lux

 

Need Help!!

Hello everybody

Somebody can change the chaos oscillator indicator,so we can put it

as a background on the chart?

Thank you very much for your time and for everything I have

learned from you all those years

Dan

Files:
 

Related Question re Window Height

Anyone suggest me how to get pixel value of main window height. I want to calculate y_distance from the bottom of the main window by the following method.

y_distance = (price-WindowPriceMin())/(WindowPriceMax()-WindowPriceMin())*WindowHeight

I need to get the value of WindowHeight in pixel in order to give y-distance in pixel.

iscuba11:
Thanks a whole bunch for the code enlightening. Another golden nugget to add to my learning.

Thanks and have a great weekend!!

Dave <<<
 

Calculation of Muliti-Time Frame Moving average

Hello Traders,

I am working on indicator and i need to know how i can calculat a multi time frame moving average into a simple time frame

for exemple :

i need to convert

SMACurrent=iMA(NULL,60,1,0,MODE_SMA,PRICE_CLOSE,shift)

SMAPrevious=iMA(NULL,60,1,0,MODE_SMA,PRICE_CLOSE,shift+1)

I have heard 23 is the Exponential for convention but i am not sur.

How is value of "1" for time current (5M)

SMACurrent=iMA(NULL,5,?????,0,MODE_SMA,PRICE_CLOSE,shift)

SMAPrevious=iMA(NULL,5,????,0,MODE_SMA,PRICE_CLOSE,shift+1)

Thank's for your help

Bixwin

 

How can I choose one line at a time to process when I have a number of lines? something like

if (Askval5) { buy=1;sell=0; }

if (Askval4) { buy=1;sell=0; }

if (Askval3) { buy=1;sell=0; }

if (Askval2) { buy=1;sell=0; }

if (Askval1) { buy=1;sell=0; }

Reason: