Jump to content

UNIVERSAL BOSS


Recommended Posts

Re: UNIVERSAL BOSS

 

indicators and EA here: http://stashbox.org/606005/UBossMan.zip

 

could one of our skilled programs have a look and see if they can clean up the money management? there's two generic variables concerning money management, i dont know what they are.

 

if a 'traditional' money management can be done, that'd be great. :-bd

"It is inconceivable that anyone will divulge a truly effective get-rich scheme for the price of a book."

Victor Niederhoffer (1943–), US hedge fund manager and statistician

Link to comment
Share on other sites

Re: UNIVERSAL BOSS

 

Added Five digit or four digit broker routine.

Added proper money Management

Cleaned up the code

 

Must be worth at lease one Kudo :D

 

 

//==========================================

 

#property copyright "Universal Boss"

#property link "===="

#include <WinUser32.mqh>

//========================

extern string Broker = "------Broker Five or Four Digit------";

extern bool FiveDigitsBroker = true;

//========================

extern string MManagement= " --- MM section ---";

extern string MM1 = "Turn On Money Managemet";

extern bool ActivateMM=false;//

extern double LotBalancePcnt=1;//

extern string LotSet = "Ignored If MM Turned On";

extern double Lots = 1.0;

//======================

extern string Website = "";

extern string OnlyTrades = "";

extern string Timeframes = "Open - H4 Recommended";

extern int g_magic_108 = 1234;

extern bool MailAlert = FALSE;

//=======================

extern int Slippage = 6;

extern bool UseStoploss = FALSE;

extern int Stoploss = 30;

extern bool UseTakeProfit = TRUE;

extern int TakeProfit = 60;

extern bool UseTrailing = TRUE;

extern int TrailingStop = 25;

extern string Trend_Line = "";

extern int CCIPeriod = 200;

extern string STO_IND = "";

extern int KPeriod = 5;

extern int DPeriod = 3;

extern int Slowing = 3;

extern string BOSS_IND = "";

extern int SF = 6;

extern int RSI_Period = 4;

extern double DARFACTOR = 2.5;

extern string BOSS_MA_TREND = "";

extern int Lookback = 1;

extern string STANDARD_MA = "";

extern int MA_Period = 7;

string JUDGEMENT = "";

int gi_244 = 10;

 

bool gi_256 = FALSE;

bool gi_260 = FALSE;

double gd_264 = 1.0;

bool gi_116 = FALSE;

 

 

int gi_unused_288;

string gs_292;

string gsa_300[4];

int g_bars_304;

int gi_308;

bool gi_312 = FALSE;

double _g_point;

int init() {

 

_g_point = Point;

if(FiveDigitsBroker)

{

if(Digits==4 || Digits==2)

if(MessageBox("You selected 5 digits broker but it seems to be 4 digits one! Please change FiveDigitsBroker = true to false. \nContinue?","Question", MB_YESNO|MB_ICONQUESTION)==IDNO) return(0);

_g_point = Point*10;

Print("Platform Point is ", Point,"; we are using ",_g_point);

}

 

 

g_bars_304 = Bars;

if (gi_116) gi_308 = 0;

else gi_308 = 1;

if (MarketInfo(Symbol(), MODE_LOTSIZE) == 10000.0) gs_292 = "Mini";

if (MarketInfo(Symbol(), MODE_LOTSIZE) == 100000.0) gs_292 = "Standard";

if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.01) gi_unused_288 = 2;

if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.1) gi_unused_288 = 1;

return (0);

}

 

int deinit() {

return (0);

}

 

int start() {

 

//............

double free=AccountFreeMargin();

//.......Updated Chart Data Comments

Comment ("","\n","\n","\n","\n","\n",

"\n","...................................... ",

"\n",( "Current Open Trade Profit/Loss is : ",AccountProfit()), // What is our current profit/loss

"\n","...................................... ",

"\n",( "Account Curency:",AccountCurrency()),

"\n", "Account free margin is ",DoubleToStr(free,2), // What is our freee margin

"\n","...................................... ",

"\n","High day price. ",MarketInfo(Symbol(),MODE_HIGH), // What was todays high

"\n","Low day price.",MarketInfo(Symbol(),MODE_LOW), // What was todays low

"\n","Currency Spread is ",MarketInfo(Symbol(),MODE_SPREAD),// What is current pip spread

"\n","Current Ask Price is ",MarketInfo(Symbol(),MODE_ASK), // What is current Ask Price

"\n","Current Bid Price is ",MarketInfo(Symbol(),MODE_BID),// What is current Bid Price

"\n",( "Leverage 1:",AccountLeverage()),

"\n","...................................... ",

"\n",( "Account Balance:",AccountBalance()), // What is account Balance

"\n","...................................... ",

"\n" ,"Current Broker Time Is ",TimeToStr(TimeCurrent())); // What is broker time

 

//....End Chart Features

HideTestIndicators(TRUE);

 

int l_ticket_8;

double l_price_12;

double l_price_20;

int li_0 = 0;

if (gi_116 && Bars != g_bars_304) gi_312 = FALSE;

int l_ord_total_4 = OrdersTotal();

li_0 = 0;

if (gi_256) {

if (gs_292 == "Standard") {

if (gi_260) Lots = MathMax(0.01, NormalizeDouble(AccountEquity() * gd_264 / 100000.0, 2));

else Lots = MathMax(0.1, NormalizeDouble(AccountEquity() * gd_264 / 100000.0, 1));

} else {

if (gs_292 == "Mini") {

if (gi_260) Lots = MathMax(0.01, NormalizeDouble(AccountEquity() * gd_264 / 10000.0, 2));

else Lots = MathMax(0.1, NormalizeDouble(AccountEquity() * gd_264 / 10000.0, 1));

}

}

}

Lots = MathMin(Lots, MarketInfo(Symbol(), MODE_MAXLOT));

gsa_300[3] = Lots;

double l_ima_28 = iMA(NULL, 0, 1, 0, MODE_EMA, PRICE_CLOSE, gi_308 + 0);

double l_icci_36 = iCCI(NULL, 0, CCIPeriod, PRICE_CLOSE, gi_308 + 0);

double l_icci_44 = iCCI(NULL, 0, CCIPeriod, PRICE_CLOSE, gi_308 + 1);

double l_icci_52 = iCCI(NULL, 0, CCIPeriod, PRICE_CLOSE, gi_308 + 2);

double l_icci_60 = iCCI(NULL, 0, CCIPeriod, PRICE_CLOSE, gi_308 + 3);

double l_istochastic_68 = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, 0, MODE_MAIN, gi_308 + 0);

double l_istochastic_76 = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, 0, MODE_MAIN, gi_308 + 1);

double l_istochastic_84 = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, 0, MODE_SIGNAL, gi_308 + 0);

double l_icustom_92 = iCustom(NULL, 0, "BOSS", SF, RSI_Period, DARFACTOR, 0, gi_308 + 0);

double l_icustom_100 = iCustom(NULL, 0, "BOSS", SF, RSI_Period, DARFACTOR, 1, gi_308 + 0);

double l_icustom_108 = iCustom(NULL, 0, "BOSS_MA", Lookback, 0, gi_308 + 0);

double l_ima_116 = iMA(NULL, 0, MA_Period, 0, MODE_SMA, PRICE_CLOSE, gi_308 + 0);

double l_ima_124 = iMA(NULL, 0, MA_Period, 0, MODE_SMA, PRICE_CLOSE, gi_308 + 1);

double l_ima_132 = iMA(NULL, 0, MA_Period, 0, MODE_SMA, PRICE_CLOSE, gi_308 + 2);

double l_imfi_140 = iMFI(NULL, 0, 14, 0);

double l_imfi_148 = iMFI(NULL, 0, 14, 1);

double l_imfi_156 = iMFI(NULL, 0, 14, 2);

double ld_164 = l_istochastic_68 - l_istochastic_84;

double ld_172 = l_icustom_92 - l_icustom_100;

 

bool li_180 = FALSE;

for (int l_pos_184 = 0; l_pos_184 < l_ord_total_4; l_pos_184++) {

OrderSelect(l_pos_184, SELECT_BY_POS, MODE_TRADES);

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

li_180 = TRUE;

if (OrderType() == OP_BUY) {

if (ld_164 < (-gi_244) && l_icci_36 < l_icci_44 && l_imfi_140 < l_imfi_148 && l_ima_116 < l_ima_124) li_0 = 3;

if (li_0 == 3 && (gi_116 && !gi_312) || (!gi_116 && Bars != g_bars_304)) {

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);

if (MailAlert) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");

if (!gi_116) g_bars_304 = Bars;

li_180 = FALSE;

} else {

if (UseTrailing && TrailingStop > 0) {

if (Bid - OrderOpenPrice() > _g_point * TrailingStop) {

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

OrderModify(OrderTicket(), OrderOpenPrice(), Bid - _g_point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);

if (!gi_116) g_bars_304 = Bars;

}

}

}

}

} else {

if (ld_164 > gi_244 && l_icci_36 > l_icci_44 && l_imfi_140 > l_imfi_148 && l_ima_116 > l_ima_124) li_0 = 4;

if (li_0 == 4 && (gi_116 && !gi_312) || (!gi_116 && Bars != g_bars_304)) {

OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);

if (MailAlert) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");

if (!gi_116) g_bars_304 = Bars;

li_180 = FALSE;

} else {

if (UseTrailing && TrailingStop > 0) {

if (OrderOpenPrice() - Ask > _g_point * TrailingStop) {

if (OrderStopLoss() > Ask + _g_point * TrailingStop || OrderStopLoss() == 0.0) {

OrderModify(OrderTicket(), OrderOpenPrice(), Ask + _g_point * TrailingStop, OrderTakeProfit(), 0, DarkOrange);

if (!gi_116) g_bars_304 = Bars;

}

}

}

}

}

}

}

if (ld_164 > gi_244 && ld_172 > gi_244 && l_ima_116 > l_ima_124) li_0 = 1;

if (ld_164 < (-gi_244) && ld_172 < (-gi_244) && l_ima_116 < l_ima_124) li_0 = 2;

if (li_0 == 1 && (gi_116 && !gi_312) || (!gi_116 && Bars != g_bars_304)) {

if (!li_180) {

if (AccountFreeMargin() < 1000.0 * Lots) {

Print("We have no money. Free Margin = ", AccountFreeMargin());

return (0);

}

if (UseStoploss) l_price_12 = Ask - Stoploss * _g_point;

else l_price_12 = 0.0;

if (UseTakeProfit) l_price_20 = Ask + TakeProfit * _g_point;

else l_price_20 = 0.0;

l_ticket_8 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, Slippage, l_price_12, l_price_20, "Buy(#" + g_magic_108 + ")", g_magic_108, 0, DodgerBlue);

if (l_ticket_8 > 0) {

if (OrderSelect(l_ticket_8, SELECT_BY_TICKET, MODE_TRADES)) {

Print("BUY order opened : ", OrderOpenPrice());

if (MailAlert) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");

} else Print("Error opening BUY order : ", GetLastError());

}

if (gi_116) gi_312 = TRUE;

if (!gi_116) g_bars_304 = Bars;

return (0);

}

}

if (li_0 == 2 && (gi_116 && !gi_312) || (!gi_116 && Bars != g_bars_304)) {

if (!li_180) {

if (AccountFreeMargin() < 1000.0 * Lots) {

Print("We have no money. Free Margin = ", AccountFreeMargin());

return (0);

}

if (UseStoploss) l_price_12 = Bid + Stoploss * _g_point;

else l_price_12 = 0.0;

if (UseTakeProfit) l_price_20 = Bid - TakeProfit * _g_point;

else l_price_20 = 0.0;

l_ticket_8 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, Slippage, l_price_12, l_price_20, "Sell(#" + g_magic_108 + ")", g_magic_108, 0, DeepPink);

if (l_ticket_8 > 0) {

if (OrderSelect(l_ticket_8, SELECT_BY_TICKET, MODE_TRADES)) {

Print("SELL order opened : ", OrderOpenPrice());

if (MailAlert) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");

} else Print("Error opening SELL order : ", GetLastError());

}

if (gi_116) gi_312 = TRUE;

if (!gi_116) g_bars_304 = Bars;

return (0);

}

}

if (!gi_116) g_bars_304 = Bars;

return (0);

}

double GetLots()

{

if (ActivateMM)

{

double LotStep = MarketInfo(Symbol(), MODE_LOTSTEP);

double LotPrec = MathCeil(-MathLog(LotStep)/MathLog(10));

 

double lots = LotBalancePcnt/100.0*AccountBalance()/1000.0;

lots = NormalizeDouble(lots, LotPrec);

 

double MaxLot = MarketInfo(Symbol(), MODE_MAXLOT);

double MinLot = MarketInfo(Symbol(), MODE_MINLOT);

 

return (lots);

}

 

return (Lots);

}

//========================================

 

Enjoy.

Link to comment
Share on other sites

Re: UNIVERSAL BOSS

 

http://stashbox.org/606258/eurusd%204h%200.1%20lots%202009.gif

 

somehow i managed to get it to test with lot size erros passed by.

 

0.1 lot size.

 

hopefully pheniox's fixes it up.

"It is inconceivable that anyone will divulge a truly effective get-rich scheme for the price of a book."

Victor Niederhoffer (1943–), US hedge fund manager and statistician

Link to comment
Share on other sites

Re: UNIVERSAL BOSS

 

i cannot get your version to trade pheniox.

 

 

 

Humm,,,

 

Trades fine here on the EURUSD and GBPUSD not sure if it is making pips. HAve not done any long term tests yet been busy on some new programming here but will see what I can figure out.

 

Do you have the indicators :

Boss and BOSS_EA installed?

 

There are two true and or false setting that I have no idea yet :hammer: what they are for other than MM which I have by passed.

Have also not tried it on a four digit as my testers are all five.

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...