can anyone help me code the risk reward on this EA please?

 

I got all the details zipped up, with a capture and so on and so fort. It's not a big pieces of coding I'm sure for those who knows, I'm just really bad at it. Appreciate it! Cheers.


mank

Files:
ea.rar  36 kb
 
 
doshur:
what currency pair?

for all, and all timeframes.

 
mank:

for all, and all timeframes.

Anyone else incline to help out a non-programmer with this risk reward set up? Thanks.

 
break-even system = strong market strategy

chase_trend

actually, forex like GBPUSD have 55% is being weak, and the rest being strong ~ ~

so i don't think your idea will work~ ~

plz forgive if make any offense

 
-on/off switch between manual profit / target and implemented

- One hour after U.S. market close EA shut down till 3 hours before London open, (apply only to 1hr timeframe and below).
A drop down menu to change EA operation time would be cool too.
- Signals valid on the crosses of the 150ema with the 365ema, on a down cross only sell signals are activated.
**Position management**
-Stop loss always placed 30 pips below / above the High or Low. (enable manual change)
For exmample:
Signal is: if (High[3]<High[4]&&Low[3]>Low[4]&&High[2]<High[3]&&Low[2]>Low[3]&&Close[1]>Close[2]&&Open[0]) BuyOp=true;
In this buy signal the stop then will be 30 pips above [4], since that is the largest number in the signal, OR, if bar [2] or any bar prior to the signal exceed the High of [4] then the stop will be placed 30 pips above that. Same goes for sell sigals.
Note: of the signal contains a bar [6] then that's where the stop will be placed. Always the Highest number bar. +30 pips.
-Risk Reward
The distance from entry and stop will be used as risk reward, not including the 30 pips extra.
For example:
Long EU at 1.2600, stop at 1.2580 (20 pips + 30 pips extra) which will then be 1.2500 stop. Although the risk reward counts
onwards from 1.2580 which is 20 pips. So once the price move up 20 pips (note it will enter 3 positions on every signal), the first lot is taken out with 20 pips profit and then the stop comes to break even on the other 2 lots. Would be good if you can create a drop down menu for how many positions per signal also. So the other 2 positions, once price reaches 2:1 (40 pips in this case) then another profit is taken.. And leave the 3rd and last position for 3:1 (60 pips)
important thing after 1:1 stops for the last remaining 2 positions goes to break even.
I attached you a .gif so you see what I mean.
p.s. I guess the trail, fixed stop and fixed take profit will have to be taken away also.. I'm really bad at coding so.
Cheers.
extern int TakeProfit = 30;
extern int TrailingStop = 30;
extern int StopLoss = 0;
extern double Lots = 0.1;
extern int magicnumber = 777;
extern bool PolLots = true;
extern int MaxOrders = 1;
int prevtime;
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{

int i=0;
int total = OrdersTotal();
for(i = 0; i <= total; i++)
{
if(TrailingStop>0)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderMagicNumber() == magicnumber)
{
TrailingStairs(OrderTicket(),TrailingStop);
}
}
}
bool BuyOp=false;
bool SellOp=false;

if (High[0]>High[1]&&High[1]>High[2]&&High[2]>High[3]&&Open[0]>Open[1]&&Open[1]>Open[2]&&Open[2]>Open[3]) BuyOp=true;
if (High[0]<High[1]&&High[1]<High[2]&&High[2]<High[3]&&Open[0]<Open[1]&&Open[1]<Open[2]&&Open[2]<Open[3]) SellOp=true;
if(Time[0] == prevtime)
return(0);
prevtime = Time[0];
if(!IsTradeAllowed())
{
prevtime = Time[1];
return(0);
}

if (total < MaxOrders || MaxOrders == 0)
{
if(BuyOp)
{
if (StopLoss!=0)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-(StopLoss*Point),Ask+(TakeProfit*Point),"OpenTiks_Buy",magicnumber,0,Green);
}
else
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+(TakeProfit*Point),"OpenTiks_Buy",magicnumber,0,Green);
}
}
if(SellOp)
{
if (StopLoss!=0)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+(StopLoss*Point),Bid-(TakeProfit*Point),"OpenTiks_Sell",magicnumber,0,Red);
}
else
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-(TakeProfit*Point),"OpenTiks_Sell",magicnumber,0,Red);
}
}
{
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
void TrailingStairs(int ticket,int trldistance)
{
int Spred=Ask - Bid;
if (OrderType()==OP_BUY)
{
if((Bid-OrderOpenPrice())>(Point*trldistance))
{
if(OrderStopLoss()<Bid-Point*trldistance || (OrderStopLoss()==0))
{
OrderModify(ticket,OrderOpenPrice(),Bid-Point*trldistance,OrderTakeProfit(),0,Green);
if (PolLots)
if (NormalizeDouble(OrderLots()/2,2)>MarketInfo(Symbol(), MODE_MINLOT))
{
OrderClose(ticket,NormalizeDouble(OrderLots()/2,2),Ask,3,Green);
}
else
{
OrderClose(ticket,OrderLots(),Ask,3,Green);
}
}
}
}
else
{
if((OrderOpenPrice()-Ask)>(Point*trldistance))
{
if((OrderStopLoss()>(Ask+Point*trldistance)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*trldistance,OrderTakeProfit(),0,Red);
if (PolLots)
if (NormalizeDouble(OrderLots()/2,2)>MarketInfo(Symbol(), MODE_MINLOT))
{
OrderClose(ticket,NormalizeDouble(OrderLots()/2,2),Bid,3,Green);
}
else
{
OrderClose(ticket,OrderLots(),Bid,3,Green);
}
}
}
}
}
//--------------------------------------------------------------
your code have too many { }
i advise u to use operator --continue
to avoid too many { }
 

yeah.. I'm not sure how to sort it all out correctly, just copied the main scripts from another EA.... I guess those fixed stops and trails can be deleted from the script, most important is the buy sell signals, the if (Close[2]>Close[3]) BuyOP etc... the strategy works on my live trading, I'd just really like to backtest and see the results, it will not be close to manual trading cause of confluence areas etc.. but I have gotten quite nice results on some pairs with the fixed stops, trails and target profit... a dynamic one would way more logical..


thx for posting it up chiwing

 
hi, mank
i want to ask what do the picture text " 2nd target 2:1" means??
2:1, 3:1 do u purport the lot--> money management?
 
chiwing:
hi, mank
i want to ask what do the picture text " 2nd target 2:1" means??
2:1, 3:1 do u purport the lot--> money management?

There will be 3 positions on each signal y'know, if the stop is 50pips and it hits the first target which is 1:1 (50pips), then the stop of the other two lots goes to break even, next target is then 2:1 which will be 100 pips, and the last position for 3:1, 150 pips.... basically how many times you're making compare to your risk/stop.

 
no volunteer? how much would it cost to get it coded? Can someone make me an offer...?
 
sorry, i mix up the terms break-even and break -trend~ ~
Reason: