Money Management in EAsBack to topics list |
|
amsterdamer
2009.07.01 21:15
Hi, I'm trying to add some money management rules to my EA, but my code seems to be false. the only result I get is MMlots=Risk/100 here it is: //------------------------ double A_Up,A_Down; double pA_Up,pA_Down; double PipValue,SL_distance,MMlots; int res,total; A_Up=iCustom(NULL,0,"Custom Aroon",period,300,0,0); A_Down=iCustom(NULL,0,"Custom Aroon",period,300,1,0); pA_Up=iCustom(NULL,0,"Custom Aroon",period,300,0,1); pA_Down=iCustom(NULL,0,"Custom Aroon",period,300,1,1); PipValue=MarketInfo(Symbol(),16); total=OrdersTotal(); if(total<1) { if(pA_Up>pA_Down && A_Up<A_Down) { if(Money_Management) { SL_distance=iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,extremum_period,0))-Bid+SL_deviation; MMlots=MathRound(((Risk)/(SL_distance*PipValue))); res=OrderSend(Symbol(),OP_SELL,MMlots,Bid,3,iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,extremum_period,0))+SL_deviation*Point,Bid-TP*Point,"",MAGICNB,Red); Print("Money Management parameters:Risk",Risk,"SL_distance",SL_distance,"PipValue",PipValue); if(res<1) { Print("OrderSend failed with error #",GetLastError()); PlaySound("timeout"); } } //----------------------- |
