How to code? - page 21

 
Wackena:
This is a simple 3 candles profit trailing (PT) code or more like a trailing stop. It is activated by GapPT=number of pips in profit. Attached is chart example of 3 candles method.

Wackena

extern int GapPT=10;

int c, n, p;

double LongPT, ShortPT;

c=0; p=0;

for(n=0;n<=6;n++)

{

if(High[c+1]Low[c+2]) {n--;}

c++;

p++;

if(n==3) break;

}

ShortPT=NormalizeDouble(High,Digits);

LongPT=NormalizeDouble(Low,Digits);

int total = OrdersTotal();

for(int cnt=0;cnt<total;cnt++) {

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY && OrderClosePrice()-OrderOpenPrice() >= GapPT*Point)

{

OrderModify(OrderTicket(),OrderOpenPrice(),LongPT,OrderTakeProfit(),0,GreenYellow);

}

if(OrderType()==OP_SELL && OrderOpenPrice()-OrderClosePrice() >= GapPT*Point)

{

OrderModify(OrderTicket(),OrderOpenPrice(),ShortPT,OrderTakeProfit(),0,Red);

}

}

thank you very much !!!!

1. how to i exerts it on transactions that i am incipit in the manual way? or automiticly

2.i need that it is convene to act her just when he enter to the defeat

exenple: if trailing profit 20 just the order thesis -20 trailing profit beginner to work

(forgiveness on my english i hope that you are understands me)

and again thank you very much!!!!!

 

results my meantime in this method

8.2.07 -3 pips

+50 pips

9.2.07 + 50 pips

having big potential in this method profit they maximums and defeat they minimum because the trailing profit

all of them losers because psychology of commerce and it will method exactly the opposite from psychology this

meantime i am doing this is in the manual way

i will continue to update further

you knowledge that i am right

yossi1177

 
yossi1177:
results my meantime in this method

8.2.07 -3 pips

+50 pips

9.2.07 + 50 pips

having big potential in this method profit they maximums and defeat they minimum because the trailing profit

all of them losers because psychology of commerce and it will method exactly the opposite from psychology this

meantime i am doing this is in the manual way

i will continue to update further

you knowledge that i am right

yossi1177

look this!!!!

Files:
 

trailing profit

this code not work

 

trailing ea

I posted this on the yahoo MTE&I group.

I combined 7 different trailing stop ideas into a single ea.

I have not tested this for manual trades but I have used many of the functions in eas and they do work.

It will only trail positions entered for the currency pair where attached.

It also sounds like what you want is the type 2, delayed trailing stop.

Also try the type 3 with 3 levels,

First level moves stop by the setting for that level, second level for that level and thirrd level trails from there.

For example

First move is 20 pips. To move to breakeven set the first stop to 20.

Second move 30, lock in 15 by setting second stop to 15.

Third move 40 trail by 10 by setting trailling to 10.

Robert

 

Help! i need simple code

Hello!everybody

I found almost all indicators very good, BUT indicator-- "arrow" in this forum is always above or below the bar. Many times, when i see the arrow, the best entry time has passed. It confuses me, what and when did the arrow appear?? So, i want to see the arrow display at the price positon when the arrow come out, better with the comment "XX:XX open price XXXX" on the chart left-up corner so that i may know what happened just now and deside the next step. i'm not a programmer, so i dont know how to write the code. Who here can help me finish it? thanks very much first.

Sorry for poor english..

 
Files:
 

code sought

how to write this code .....

i need to measure the height of a wave and make decision according to that.

For example ... I am looking at a 5 min chart. I see lots of up and down waves. I want to choose a wave which has a height of 40 pips or greater. How to write such a code?

Anyone?

thanks

 

Programmer Help -- Code Logic help

Hi Programmers,

I'm programming my close order logic and I don't seem to have it right:

bool LongClose()

{

if(MAFastC=MASlowP)

{

CrossedUp=false;

CrossedDn=true;

BarCount=0;

}

else

if(MAFastC>MASlowC && MAFastP<=MASlowP)

{

CrossedUp=true;

CrossedDn=false;

BarCount=0;

Alert("Crossed Down");

}

if(CrossedDn==true && NewBar()==true && Candle3mP=="Bear") BarCount++;

{

if(BarCount>=2 && Candle3mC=="Bear")

{

Alert("Close Long Position");

return(true);

}

else return(false);

}

CrossedUP/DN & BarCount are static variables.

My closing logic is: When Cross occurs it stimulates the Bar count which counts the bars since the cross. When that count reaches 2 (i.e. 2 bars after the cross) and if current bar is Bear it triggers a true return to the function.

Problem: Cross notifys ok but count doesn't occur and consequently never reaches "true" state.

Thanks for your help,

SaxMan

 

Hi. Try this.

bool LongClose()

{

if(MAFastC=MASlowP)

{

CrossedUp=false;

CrossedDn=true;

BarCount=0;

}

else

if(MAFastC>MASlowC && MAFastP<=MASlowP)

{

CrossedUp=true;

CrossedDn=false;

BarCount=0;

Alert("Crossed Down");

}

if(CrossedDn==true && NewBar()==true && Candle3mP=="Bear")

BarCount++;

if(BarCount>=2 && Candle3mC=="Bear")

{

Alert("Close Long Position");

return(true);

}

else return(false);
Reason: