How to code? - page 13

 

upon closer inspection it appears that what I have IS working and behaving exactly like a stop loss.

when I add this to it...

if(AccountEquity()+8<AccountBalance())

it behaves exactly like a stop loss at 8

so at least I've done the code right for once eh? Sadlly it's not producing the effect I wanted in the EA. It's messing with the winners who need the stop loss wider to work too. victory and defeat all at the same time...ok so be it.

 

Code debugging issue...trailing stop trigger..coders wanted

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

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()<=OP_SELL && OrderSymbol()==Symbol()) {

if(OrderType()==OP_BUY){

if(TrailingStop>0) {

if(Bid-OrderOpenPrice()>Point*TrailingStopTrigger) {

if(OrderStopLoss()<Bid-Point*TrailingStop) {

OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);

return(0);

}

}

}

}else{

if(TrailingStop>0) {

if((OrderOpenPrice()-Ask)>(Point*TrailingStopTrigger)) {

if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0)) {

OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);

return(0);

I'm still learning code. This is supposed to trigger a trailing stop to engage as a specified level. I can see from some test results that it didn't trigger when it should have.

I'm wondering if this is written correctly as 'Point*TrailingStopTrigger' is it supposed to multiply or simply add the value of the TrailingStopTrigger to Point for sell positions and subtract if for buy positions. Is that why it's not triggering like it's supposed to? Or is there something else?

 

do you have an fxdd demo? if so change the color to 0.

 
BluePearl:
do you have an fxdd demo? if so change the color to 0.

i'm using interbankFX demo. would the color thing prevent it from triggering?

 

try it with ibfx. i know it's an issue with fxdd if you use the color name in a modify order command.

 

It doesn't seem to change the results. I may have been mistaken in assuming that it should have triggered.

I have 4 reports attached. The only difference between them is the size of the stop loss. This tells me that alot of retracement is going on. That doesn't mean that I want to allow losers to play out to the full stop loss if I can shut them down based on some additional rule that doesn't disproportionally detract from the winners.

Looking at the results from the 186 stop loss report, and looking back at the charts of these 5 losers at their entries. 4 out of 5 of them the bar immediately after opening the position the next bar closed against the position. I don't know if some sort of rule like that could be added like a stop loss to close positions if the very next bar after the position opens goes against it to close the position would work or not. It would have stopped 4 of 5 losers that remained but I don't know how many of the winners it would have also shut down.

I don't know how that kind of rule would be programmed. I just manually walked thru the first 20 trades and it would have shut down 15 of 20 so that won't help.

I'm open for suggestions.

 

Someone PLEASE code these from TS for me...

Hi,

Can anyone please code the following indicators for me? They are written in TradeStation's (not)Easylanguage.

if you have trouble then PM/email me

i know it's a LOT of work but will be well worth it once whomever codes it knows what method it is...

SB

 

Before any one takes up that task, can you explain what the strategies are and give some details, url references for them. If it is an winning strategy, then someone will take up the challenge. Otherwise, why would anyone spend their time translating.

Thanks,

 

Why doesn't this code work?

I'm trying to write a piece of code that will modify the TP of allexisting trades. When I attach the code to a chart, it works only for the currency where the expert is attached. It does not modify other trades from other currency pairs. Please note that I'm not checking the OrderSymbol()==Symbol() in my code. Where is the mistake? Do I have to add a "return(0)" after each OrderModify()? Can you help me?

Does the expert allow me to open/close/modify trades of a different currency pair while the expert is attached only to a single chart? I'm trying to write a universal code that will process (ie, either modify or close) all existing trades regardless of the chart where the EA is attached to. Can someone please confirm if this is possible at all? If yes, then what is wrong with the following code?

int mTrades=OrdersTotal();

if (mTrades>0)

{

for (i=0;i<mTrades;i++)

{

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if (OrderType() == OP_BUY)

{

OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Ask+100*Point, White);

}

if (OrderType() == OP_SELL)

{

OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Bid-100*Point, White);

}

}

}

 
fxd01:
I'm trying to write a piece of code that will modify the TP of allexisting trades. When I attach the code to a chart, it works only for the currency where the expert is attached. It does not modify other trades from other currency pairs. Please note that I'm not checking the OrderSymbol()==Symbol() in my code. Where is the mistake? Do I have to add a "return(0)" after each OrderModify()? Can you help me?

Does the expert allow me to open/close/modify trades of a different currency pair while the expert is attached only to a single chart? I'm trying to write a universal code that will process (ie, either modify or close) all existing trades regardless of the chart where the EA is attached to. Can someone please confirm if this is possible at all? If yes, then what is wrong with the following code?

int mTrades=OrdersTotal();

if (mTrades>0)

{

for (i=0;i<mTrades;i++)

{

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if (OrderType() == OP_BUY)

{

OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Ask+100*Point, White);

}

if (OrderType() == OP_SELL)

{

OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Bid-100*Point, White);

}

}

}

the problem is that u are using Ask and Bid for the price.

Try to use : MarketInfo(OrderSymbol(),MODE_BID) and MarketInfo(OrderSymbol(),MODE_ASK) instead

Reason: