Jump to content

2008 ATC "AME Cross Trader"


Tango

Recommended Posts

  • 6 months later...

Re: 2008 ATC "AME Cross Trader"

 

Thanks! ^:)^

 

What currency pair and what timeframe?

 

Hi robbyg,

try this: FXDD,

GBP/CHF

Timeframe H4 (not sure jet, I´m still testing),

$10000

with Moving Average orange on Period 6

red on Period 54

 

licenseKey=

minTradeSize=0.10000000

minTradeSize,F=0

minTradeSize,1=0.10000000

minTradeSize,2=0.00000000

minTradeSize,3=0.00000000

scaleDivisor=3000

scaleDivisor,F=0

scaleDivisor,1=500

scaleDivisor,2=1

scaleDivisor,3=505

stopDollars=20000.00000000

stopDollars,F=0

stopDollars,1=20000.00000000

stopDollars,2=0.00000000

stopDollars,3=0.00000000

shortMaBars=5

shortMaBars,F=1

shortMaBars,1=1

shortMaBars,2=1

shortMaBars,3=60

longMaBars=35

longMaBars,F=1

longMaBars,1=1

longMaBars,2=1

longMaBars,3=60

stopBars=60

stopBars,F=1

stopBars,1=1

stopBars,2=1

stopBars,3=60

useLimit=1

useLimit,F=0

useLimit,1=1

useLimit,2=0

useLimit,3=0

limitPips=175

limitPips,F=1

limitPips,1=20

limitPips,2=5

limitPips,3=200

useMM=1

useMM,F=0

useMM,1=1

useMM,2=0

useMM,3=0

aggressiveMode=1

aggressiveMode,F=0

aggressiveMode,1=0

aggressiveMode,2=0

aggressiveMode,3=0

slippage=10

slippage,F=0

slippage,1=10

slippage,2=0

slippage,3=0

panicMode=0

panicMode,F=0

panicMode,1=0

panicMode,2=0

panicMode,3=0

maxTotalLots=50.00000000

maxTotalLots,F=0

maxTotalLots,1=15.00000000

maxTotalLots,2=0.00000000

maxTotalLots,3=0.00000000

 

enjoy!

 

I will post my testings end of week!

Link to comment
Share on other sites

Re: 2008 ATC "AME Cross Trader"

 

/*

Generated by EX4-TO-MQ4 decompiler V4.0.220.2 []

Website: http://purebeam.biz

E-mail : [email protected]

*/

#property copyright "Copyright ?2008, AME Labs"

#property link "http://forex.ameLabs.com"

 

#include <amelib.mqh>

 

extern string licenseKey;

extern double minTradeSize = 0.1;

extern int scaleDivisor = 500;

extern double stopDollars = 20000.0;

extern int shortMaBars = 66;

extern int longMaBars = 240;

extern int stopBars = 114;

extern int useLimit = 1;

extern int limitPips = 40;

extern int useMM = 1;

extern int aggressiveMode = 0;

extern int slippage = 10;

extern int panicMode = 0;

extern double maxTotalLots = 15.0;

double gd_unused_148 = 0.0;

double gd_unused_156 = 1000.0;

int gi_unused_164 = 0;

double gd_168;

bool gi_176 = FALSE;

double gd_180 = 0.0;

 

int init() {

ame_InitLibrary(WindowExpertName());

// gi_176 = ame_SetLicenseKey(licenseKey);

// ame_SetSendEmail(1);

if (stopDollars > 0.0) {

ame_ResetTrailingStop();

ame_BeginTrailingStop(stopDollars);

}

gd_168 = 0;

// if (IsTesting()) gi_176 = TRUE;

// else

// if (!gi_176) MessageBox("The License Key you provided is invalid or expired. Please check it and try again.", "Invalid License Key");

return (0);

}

 

int deinit() {

Print("maxBalance=" + ame_GetValue("maxBalance"));

Print("minTradeSize=" + ame_GetValue("minTradeSize"));

Print("scaleDivisor=" + ame_GetValue("scaleDivisor"));

Print("tradeSizeResetPoint=" + ame_GetValue("tradeSizeResetPoint"));

Print("shortMaBars=" + ame_GetValue("shortMaBars"));

Print("longMaBars=" + ame_GetValue("longMaBars"));

Print("stopBars=" + ame_GetValue("stopBars"));

Print("useLimit=" + ame_GetValue("useLimit"));

Print("limitPips=" + ame_GetValue("limitPips"));

Print("useMM=" + ame_GetValue("useMM"));

Print("aggressiveMode=" + ame_GetValue("aggressiveMode"));

Print("slippage=" + ame_GetValue("slippage"));

Print("panicMode=" + ame_GetValue("panicMode"));

ame_CloseLibrary();

return (0);

}

 

int start() {

int li_0;

string ls_unused_4;

/* if (!gi_176) {

Comment("Invalid License Key. Expert Advisor is disabled.");

return (0);

} */

if (IsOptimization()) {

if (AccountBalance() > ame_GetValue("maxBalance")) {

ame_SetValue("maxBalance", AccountBalance());

ame_SetValue("minTradeSize", minTradeSize);

ame_SetValue("scaleDivisor", scaleDivisor);

ame_SetValue("stopDollars", stopDollars);

ame_SetValue("shortMaBars", shortMaBars);

ame_SetValue("longMaBars", longMaBars);

ame_SetValue("stopBars", stopBars);

ame_SetValue("useLimit", useLimit);

ame_SetValue("limitPips", limitPips);

ame_SetValue("useMM", useMM);

ame_SetValue("aggressiveMode", aggressiveMode);

ame_SetValue("slippage", slippage);

ame_SetValue("panicMode", panicMode);

}

}

if (anyOrdersOpen()) {

if (gd_180 != 0.0) {

li_0 = ame_FirstOrder();

Sleep(120000);

while (li_0 > 0) {

ame_OrderModify(li_0, OrderOpenPrice(), gd_180, OrderTakeProfit(), OrderExpiration(), -1);

li_0 = ame_NextOrder();

}

gd_180 = 0;

} else

if (findExitSignal()) closeAllOrders();

return (0);

}

/* if (ame_CheckTrailingStop()) {

Comment("Trading halted. Monetary trailing stop reached.");

return (0);

}*/

int li_12 = findEntrySignal();

if (li_12 == 1) placeBuyOrder();

else

if (li_12 == 2) placeSellOrder();

return (0);

}

 

bool anyOrdersOpen() {

return (ame_AnyOpenOrders());

}

 

void closeAllOrders() {

ame_OrderCloseAll(slippage);

}

 

void placeBuyOrder() {

double ld_0 = calculateTradeSize();

double l_low_8 = Low[iLowest(Symbol(), 0, MODE_LOW, stopBars, 1)];

int li_16 = ame_OrderSend(Symbol(), 0, ld_0, Ask, slippage, l_low_8, 0, "AME Cross Trader", ame_MagicNumber(), 0, 16711680);

if (li_16 > 0) Sleep(60000 * Period());

}

 

void placeSellOrder() {

double ld_0 = calculateTradeSize();

double l_high_8 = High[iHighest(Symbol(), 0, MODE_HIGH, stopBars, 1)];

int li_16 = ame_OrderSend(Symbol(), 1, ld_0, Bid, slippage, l_high_8, 0, "AME Cross Trader", ame_MagicNumber(), 0, 255);

if (li_16 > 0) Sleep(60000 * Period());

}

 

bool findExitSignal() {

double l_ticket_36;

double l_ticket_44;

double l_ticket_56;

bool li_ret_0 = FALSE;

double ld_4 = MarketInfo(Symbol(), MODE_STOPLEVEL) * Point;

// if (ame_CheckTrailingStop()) return (TRUE);

if (DayOfWeek() == 0) return (FALSE);

if (!ame_FirstOrder()) return (FALSE);

OrderSelect(ame_FirstOrder(), SELECT_BY_TICKET);

if (Time[0] <= OrderOpenTime()) return (FALSE);

double ld_12 = OrderStopLoss();

double ld_20 = 0;

double ld_28 = 0;

if (OrderType() == OP_BUY) {

if (ld_12 == 0.0 || ld_12 < OrderOpenPrice()) ld_12 = OrderOpenPrice();

if (useLimit != 0 && OrderTakeProfit() == 0.0 && High[1] > OrderOpenPrice() + limitPips * Point && High[1] > Open[0]) ld_28 = High[1];

} else {

if (ld_12 == 0.0 || ld_12 > OrderOpenPrice()) ld_12 = OrderOpenPrice();

if (useLimit != 0 && OrderTakeProfit() == 0.0 && Low[1] < OrderOpenPrice() - limitPips * Point && Low[1] < Open[0]) ld_28 = Low[1];

}

if (OrderType() == OP_BUY) {

l_ticket_36 = Low[1];

if (l_ticket_36 - ld_12 > ld_4) ld_20 = l_ticket_36;

} else {

l_ticket_44 = High[1];

if (ld_12 - l_ticket_44 > ld_4) ld_20 = l_ticket_44;

}

if (ld_20 != 0.0 || ld_28 != 0.0) {

if (ld_20 == 0.0) ld_20 = OrderStopLoss();

if (ld_28 == 0.0) ld_28 = OrderTakeProfit();

for (int li_52 = ame_FirstOrder(); li_52 > 0; li_52 = ame_NextOrder()) {

ld_20 = fixStopPrice(OrderType(), ld_20, ld_28);

if (ld_20 != 0.0) ame_OrderModify(li_52, OrderOpenPrice(), ld_20, ld_28, 0, -1);

else return (TRUE);

}

OrderSelect(ame_FirstOrder(), SELECT_BY_TICKET);

}

if (panicMode > 0) {

l_ticket_56 = Close[1];

if (OrderType() == OP_BUY) {

if (panicMode == 1) l_ticket_56 = High[1];

if (l_ticket_56 < OrderOpenPrice()) li_ret_0 = TRUE;

} else {

if (panicMode == 1) l_ticket_56 = Low[1];

if (l_ticket_56 > OrderOpenPrice()) li_ret_0 = TRUE;

}

}

return (li_ret_0);

}

 

int findEntrySignal() {

int li_ret_0 = 0;

if (DayOfWeek() == 0) return (0);

if (AccountEquity() < gd_168) return (0);

if (!ame_IsNewBar()) return (0);

// for (int li_4 = ame_FirstOrder(); li_4; li_4 = ame_NextOrder())

if (iBarShift(Symbol(), 0, OrderOpenTime()) == 0) return (0);

double l_ima_8 = iMA(Symbol(), 0, shortMaBars, 0, MODE_SMA, PRICE_MEDIAN, 1);

double l_ima_16 = iMA(Symbol(), 0, longMaBars, 0, MODE_SMA, PRICE_MEDIAN, 1);

if (Low[1] >= l_ima_8 && l_ima_8 >= l_ima_16) li_ret_0 = 1;

else

if (High[1] <= l_ima_8 && l_ima_8 <= l_ima_16) li_ret_0 = 2;

return (li_ret_0);

}

 

double calculateTradeSize() {

double ld_12;

int li_8 = 1;

if (useMM == 1) {

ld_12 = calculateEquity();

li_8 = ld_12 / scaleDivisor;

if (li_8 < 1) li_8 = 1;

}

double ld_ret_0 = ame_FixLots(Symbol(), minTradeSize * li_8);

if (ld_ret_0 > maxTotalLots) ld_ret_0 = maxTotalLots;

return (ld_ret_0);

}

 

double calculateEquity() {

double ld_ret_0 = AccountEquity();

if (gd_168 > ld_ret_0) return (0);

if (aggressiveMode == 0) ld_ret_0 -= gd_168;

return (ld_ret_0);

}

 

double fixStopPrice(int ai_0, double ad_4, double ad_12) {

double l_price_28;

double ld_20 = MarketInfo(Symbol(), MODE_STOPLEVEL) * Point;

if (ai_0 == 1) {

l_price_28 = Ask;

if (MathAbs(ad_4 - l_price_28) < ld_20) ad_4 = l_price_28 + ld_20;

} else {

l_price_28 = Bid;

if (MathAbs(ad_4 - l_price_28) < ld_20) ad_4 = l_price_28 - ld_20;

}

if (MathAbs(ad_12 - l_price_28) < ld_20) ad_4 = 0;

return (ad_4);

}

__________________

try this guys

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...