Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

FOREXPIPBRO

Convert Mt4 to Tradstation

Recommended Posts

Below is what I believe to be an open code for the Steinitz fractal breakout strategy. I would like to know if its possible to translate this into easylanguage for tradestation. Please let me know if this is going to work, thank you

 

 

#property indicator_chart_window

#property indicator_buffers 7

#property indicator_color1 LawnGreen

#property indicator_color2 Red

#property indicator_color3 Red

#property indicator_color4 Blue

#property indicator_color5 Orange

#property indicator_color6 Red

#property indicator_color7 LawnGreen

 

int gi_76 = 67890;

extern int YourAccountNumber = 12345;

bool gi_84 = FALSE;

int gi_88 = 12;

int gi_92 = 31;

int gi_96 = 2008;

extern bool Alert_SoundON = TRUE;

extern bool EmailON = FALSE;

extern bool ShowTradeArrowsOnly = TRUE;

extern bool ShowBuySellLines = TRUE;

extern bool ShowBadTradeExits = TRUE;

extern bool ShowFibProfitTargets = TRUE;

extern int MA_Period = 50;

extern string m = "--Moving Average Types--";

extern string m0 = " 0 = SMA";

extern string m1 = " 1 = EMA";

extern string m2 = " 2 = SMMA";

extern string m3 = " 3 = LWMA";

extern int MA_Type = 0;

extern string p = "--Applied Price Types--";

extern string p0 = " 0 = close";

extern string p1 = " 1 = open";

extern string p2 = " 2 = high";

extern string p3 = " 3 = low";

extern string p4 = " 4 = median(high+low)/2";

extern string p5 = " 5 = typical(high+low+close)/3";

extern string p6 = " 6 = weighted(high+low+close+close)/4";

extern int MA_AppliedPrice = 4;

extern double AngleTreshold = 0.25;

extern int PrevMAShift = 2;

extern int CurMAShift = 0;

int g_ma_method_256 = MODE_SMA;

bool gi_260 = TRUE;

bool gi_264 = TRUE;

extern string pg0 = "Bad Trade Exits";

extern string pg = "Price Gap inputs";

extern int PriceGapMN = 100;

extern int PriceGapW1 = 60;

extern int PriceGapD1 = 40;

extern int PriceGapH4 = 25;

extern int PriceGapH1 = 20;

extern int PriceGapM30 = 15;

extern int PriceGapM15 = 10;

extern int PriceGapM5 = 5;

extern int PriceGapM1 = 3;

extern string fp = "Face Position";

extern int FacePosMN = 80;

extern int FacePosW1 = 60;

extern int FacePosD1 = 48;

extern int FacePosH4 = 24;

extern int FacePosH1 = 16;

extern int FacePosM30 = 10;

extern int FacePosM15 = 8;

extern int FacePosM5 = 4;

extern int FacePosM1 = 4;

extern string tp12 = "Fib Retrace Inputs";

extern int BarsBack = 10;

extern double FibRetraceTrade1 = 100.0;

extern double FibRetraceTrade2 = 161.8;

extern double FibRetraceTrade3 = 261.8;

extern bool AddSpreadToTargets = TRUE;

extern string ap = "Arrow Position";

extern int Arrow_Position = 5;

extern string to = "---Text Object Settings---";

extern int Text_X_Offset = 20;

extern int StatusTxtSize = 10;

extern color StatusColor = White;

extern int CommentTxtSize = 10;

extern color CommentColor = White;

extern color BuyLineColor = Aqua;

extern color SellLineColor = Yellow;

extern color Fib1Color = Pink;

extern color Fib2Color = Orange;

extern color Fib3Color = Red;

int g_datetime_464;

double g_ibuf_468[];

double g_ibuf_472[];

double g_ibuf_476[];

double g_ibuf_480[];

double g_ibuf_484[];

double g_ibuf_488[];

double g_ibuf_492[];

double gd_496;

double gd_504;

string gs_512 = "";

string gs_520;

string gs_528;

int g_datetime_536;

bool g_global_var_540;

bool g_global_var_544;

int gi_548;

int gi_552;

int gi_556;

string gs_560;

string gs_568;

string gs_576;

string gs_584 = "Steinitz Fractal Breakout Status";

int gi_592;

bool gi_596 = FALSE;

string gs_600 = "_SFBInd15_";

bool gi_608;

bool gi_612;

double gd_616;

double gd_624;

double g_ima_632;

double g_ima_640;

double gd_648;

double gd_656;

double gd_664;

double gd_672;

double g_ilow_680;

double g_ihigh_688;

double gd_696;

double gd_704;

double gd_712;

int g_time_720 = 0;

int g_time_724 = 0;

int g_time_728 = 0;

int gi_732 = 0;

int gi_736;

string g_var_name_740;

string g_var_name_748;

string g_var_name_756;

string g_var_name_764;

string g_var_name_772;

string g_var_name_780;

string g_var_name_788;

string g_var_name_796;

string g_var_name_804;

string g_var_name_812;

string g_var_name_820;

string g_var_name_828;

string g_var_name_836;

string g_var_name_844;

string g_var_name_852;

bool gi_860 = TRUE;

 

int init() {

string ls_0;

string ls_8;

string ls_16;

bool li_24;

string l_name_36;

SetIndexStyle(0, DRAW_ARROW, EMPTY);

SetIndexArrow(0, 233);

SetIndexBuffer(0, g_ibuf_468);

SetIndexStyle(1, DRAW_ARROW, EMPTY);

SetIndexArrow(1, 234);

SetIndexBuffer(1, g_ibuf_472);

SetIndexStyle(2, DRAW_LINE, STYLE_SOLID);

SetIndexBuffer(2, g_ibuf_476);

SetIndexStyle(3, DRAW_LINE, STYLE_SOLID);

SetIndexBuffer(3, g_ibuf_480);

SetIndexStyle(4, DRAW_LINE, STYLE_SOLID);

SetIndexBuffer(4, g_ibuf_484);

SetIndexStyle(5, DRAW_ARROW, EMPTY);

SetIndexArrow(5, 76);

SetIndexBuffer(5, g_ibuf_492);

SetIndexStyle(6, DRAW_ARROW, EMPTY);

SetIndexArrow(6, 76);

SetIndexBuffer(6, g_ibuf_488);

if (MA_Type >= 4) li_24 = FALSE;

else li_24 = MA_Type;

switch (li_24) {

case 0:

g_ma_method_256 = 0;

ls_0 = "sma10";

ls_8 = "sma21";

ls_16 = "sma50";

break;

case 1:

g_ma_method_256 = 1;

ls_0 = "ema10";

ls_8 = "ema21";

ls_16 = "ema50";

break;

case 2:

g_ma_method_256 = 2;

ls_0 = "smma10";

ls_8 = "smma21";

ls_16 = "smma50";

break;

case 3:

g_ma_method_256 = 3;

ls_0 = "lwma10";

ls_8 = "lwma21";

ls_16 = "lwma50";

break;

default:

g_ma_method_256 = 0;

ls_0 = "sma10";

ls_8 = "sma21";

ls_16 = "sma50";

}

SetIndexLabel(2, ls_0);

SetIndexLabel(3, ls_8);

SetIndexLabel(4, ls_16);

gd_496 = Get_mFactor();

gi_596 = FALSE;

ClearArrows();

DeleteBadLabels();

if (IsDemo() == TRUE) gi_596 = TRUE;

if (gi_596 == FALSE) gi_596 = CheckAccountNumber();

if (gi_596 == TRUE) {

DeleteExistingLabels();

SetupLabels();

ClearLabels();

gd_504 = SetPoint();

g_global_var_540 = FALSE;

g_global_var_544 = FALSE;

OutputStatusToChart(gs_584 + " INITIALIZED SUCCESSFULLY");

if (gi_84 == TRUE) OutputComment1ToChart("Expires on " + gi_88 + "/" + gi_92 + "/" + gi_96);

else OutputComment1ToChart("No expiration");

}

if (CurMAShift >= PrevMAShift) {

Print("Error: CurMAShift >= PrevMAShift");

PrevMAShift = 6;

CurMAShift = 0;

}

GetGlobalVars();

DeleteFractObjects();

DeleteBadLabels();

int l_objs_total_32 = ObjectsTotal();

for (int li_44 = 0; li_44 < l_objs_total_32; li_44++) {

l_name_36 = ObjectName(li_44);

Print(li_44, "Object name for object #", li_44, " is " + l_name_36);

}

return (0);

}

 

int deinit() {

ClearLabels();

DeleteExistingLabels();

ClearArrows();

DeleteFractObjects();

return (0);

}

 

int FibRetracement(int ai_0, int ai_4) {

int li_ret_16;

int l_highest_8 = iHighest(NULL, 0, MODE_HIGH, BarsBack, ai_4);

int l_lowest_12 = iLowest(NULL, 0, MODE_LOW, BarsBack, ai_4);

g_ihigh_688 = iHigh(NULL, 0, l_highest_8);

g_ilow_680 = iLow(NULL, 0, l_lowest_12);

if (ai_0 == 0)

if (g_ihigh_688 > g_ilow_680) li_ret_16 = MathFloor((g_ihigh_688 - g_ilow_680) / gd_504);

if (ai_0 == 1)

if (g_ilow_680 < g_ihigh_688) li_ret_16 = MathFloor((g_ihigh_688 - g_ilow_680) / gd_504);

return (li_ret_16);

}

 

void FibLines(int ai_0, int ai_4) {

int li_8 = MarketInfo(Symbol(), MODE_SPREAD);

if (Digits == 3 || Digits == 5) li_8 /= 10;

int li_12 = FibRetracement(ai_0, ai_4);

if (ai_0 == 0) {

gd_696 = g_ilow_680 + li_12 * FibRetraceTrade1 / 100.0 * gd_504;

if (AddSpreadToTargets) gd_696 += li_8 * gd_504;

SaveFib1(gd_696);

gd_704 = g_ilow_680 + li_12 * FibRetraceTrade2 / 100.0 * gd_504;

if (AddSpreadToTargets) gd_704 += li_8 * gd_504;

SaveFib2(gd_704);

gd_712 = g_ilow_680 + li_12 * FibRetraceTrade3 / 100.0 * gd_504;

if (AddSpreadToTargets) gd_712 += li_8 * gd_504;

SaveFib3(gd_712);

}

if (ai_0 == 1) {

gd_696 = g_ihigh_688 - li_12 * FibRetraceTrade1 / 100.0 * gd_504;

if (AddSpreadToTargets) gd_696 -= li_8 * gd_504;

SaveFib1(gd_696);

gd_704 = g_ihigh_688 - li_12 * FibRetraceTrade2 / 100.0 * gd_504;

if (AddSpreadToTargets) gd_704 -= li_8 * gd_504;

SaveFib2(gd_704);

gd_712 = g_ihigh_688 - li_12 * FibRetraceTrade3 / 100.0 * gd_504;

if (AddSpreadToTargets) gd_712 -= li_8 * gd_504;

SaveFib3(gd_712);

}

RemoveLine("Fib1");

RemoveLine("Fib2");

RemoveLine("Fib3");

DisplayLine("Fib1", gd_696, Fib1Color);

DisplayLine("Fib2", gd_704, Fib2Color);

DisplayLine("Fib3", gd_712, Fib3Color);

}

 

int start() {

int li_8;

int li_12;

int li_16 = IndicatorCounted();

DeleteBadLabels();

if (gi_552 < 10) {

SetupLabels();

ClearLabels();

DeleteExistingLabels();

SetupLabels();

}

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

gi_592 = CheckTradeFilters();

if (gi_592 == 1) return (0);

if (li_16 < 0) return (-1);

if (li_16 > 0) li_16--;

int li_0 = Bars - li_16;

if (gi_860) {

ClearArrows();

gi_860 = FALSE;

}

for (int li_4 = li_0 - 1; li_4 >= 0; li_4--) {

GetMAs(li_4 + 1);

gi_608 = FALSE;

SaveBuy(gi_608);

gi_612 = FALSE;

SaveSell(gi_612);

CheckMA_Angle(li_4 + 1);

CheckHighLowRules(li_4 + 1);

CheckMAs();

if (gi_608) {

gd_616 = iHigh(NULL, 0, li_4 + 1);

SaveBuy1(gd_616);

}

if (gi_612) {

gd_624 = iLow(NULL, 0, li_4 + 1);

SaveSell1(gd_624);

}

if (ShowTradeArrowsOnly) {

if (gi_608) {

if (iHigh(NULL, 0, li_4) <= gd_616) {

gi_608 = FALSE;

SaveBuy(gi_608);

}

}

if (gi_612) {

if (iLow(NULL, 0, li_4) >= gd_624) {

gi_612 = FALSE;

SaveSell(gi_612);

}

}

}

if (gi_608) {

if (li_4 == 0) {

if (ShowTradeArrowsOnly) {

if (NewTradeBar()) ShowAlert("Buy Trade ");

} else

if (NewSignalBar()) ShowAlert("Buy Alert ");

}

li_8 = MathRound((High[li_4 + 1] - gd_672) / gd_504);

if (ShowTradeArrowsOnly) gs_528 = GetSignalTime(li_4, 1);

else gs_528 = GetSignalTime(li_4 + 1, 0);

gs_512 = gs_520 + " - D:" + li_8 + " A:" + DoubleToStr(gd_648, 2) + " at " + gs_528;

OutputComment2ToChart(gs_512);

if (ShowTradeArrowsOnly) {

g_ibuf_468[li_4] = iLow(NULL, 0, li_4) - Arrow_Position * gd_504;

if (ShowFibProfitTargets) FibLines(0, li_4 + 1);

} else g_ibuf_468[li_4 + 1] = iLow(NULL, 0, li_4 + 1) - Arrow_Position * gd_504;

g_global_var_540 = FALSE;

SaveLastArrow(0);

g_global_var_544 = TRUE;

SaveLastSmile(1);

g_datetime_464 = Time[0];

if (ShowBuySellLines) {

DisplayLine("FractBuy", gd_616, BuyLineColor);

RemoveLine("FractSell");

}

} else {

if (gi_612) {

if (li_4 == 0) {

if (ShowTradeArrowsOnly) {

if (NewTradeBar()) ShowAlert("Sell Trade ");

} else

if (NewSignalBar()) ShowAlert("Sell Alert ");

}

li_8 = MathRound((gd_672 - (Low[li_4 + 1])) / gd_504);

if (ShowTradeArrowsOnly) gs_528 = GetSignalTime(li_4, 1);

else gs_528 = GetSignalTime(li_4 + 1, 0);

gs_512 = gs_520 + " - D:" + li_8 + " A:" + DoubleToStr(gd_648, 2) + " at " + gs_528;

OutputComment2ToChart(gs_512);

if (ShowTradeArrowsOnly) {

g_ibuf_472[li_4] = iHigh(NULL, 0, li_4) + Arrow_Position * gd_504;

if (ShowFibProfitTargets) FibLines(1, li_4 + 1);

} else g_ibuf_472[li_4 + 1] = iHigh(NULL, 0, li_4 + 1) + Arrow_Position * gd_504;

g_global_var_540 = TRUE;

SaveLastArrow(1);

g_global_var_544 = FALSE;

SaveLastSmile(0);

g_datetime_464 = Time[0];

if (ShowBuySellLines) {

DisplayLine("FractSell", gd_624, SellLineColor);

RemoveLine("FractBuy");

}

}

}

if (ShowBadTradeExits) {

if (g_global_var_540 == 0) {

if (g_global_var_544 != 0) {

if (CheckBadExit(0, li_4 + 1)) {

li_12 = GetFacePos(Period());

g_ibuf_488[li_4 + 1] = iLow(NULL, 0, li_4 + 1) - li_12 * gd_504;

g_global_var_544 = FALSE;

SaveLastSmile(0);

if (li_4 == 0)

if (NewBadTradeBar()) ShowAlert("BUY Trade Exit");

}

}

}

if (g_global_var_540 == 1) {

if (g_global_var_544 != 1) {

if (CheckBadExit(1, li_4 + 1)) {

li_12 = GetFacePos(Period());

g_ibuf_492[li_4 + 1] = iHigh(NULL, 0, li_4 + 1) + li_12 * gd_504;

g_global_var_544 = TRUE;

SaveLastSmile(1);

if (li_4 == 0)

if (NewBadTradeBar()) ShowAlert("SELL Trade Exit");

}

}

}

}

}

return (0);

}

 

double Get_mFactor() {

double ld_ret_8 = 10000.0;

string ls_0 = StringSubstr(Symbol(), 3, 3);

if (ls_0 == "JPY") ld_ret_8 = 100.0;

int li_16 = PrevMAShift - CurMAShift;

ld_ret_8 /= li_16;

return (ld_ret_8);

}

 

bool NewSignalBar() {

if (g_time_720 == Time[0]) return (FALSE);

g_time_720 = Time[0];

return (TRUE);

}

 

bool NewTradeBar() {

if (g_time_724 == Time[0]) return (FALSE);

g_time_724 = Time[0];

return (TRUE);

}

 

bool NewBadTradeBar() {

if (g_time_728 == Time[0]) return (FALSE);

g_time_728 = Time[0];

return (TRUE);

}

 

void GetMAs(int ai_0) {

gd_656 = iMA(NULL, 0, 10, 0, g_ma_method_256, PRICE_CLOSE, ai_0);

gd_664 = iMA(NULL, 0, 21, 0, g_ma_method_256, PRICE_CLOSE, ai_0);

gd_672 = iMA(NULL, 0, 50, 0, g_ma_method_256, PRICE_CLOSE, ai_0);

g_ibuf_476[ai_0] = gd_656;

g_ibuf_480[ai_0] = gd_664;

g_ibuf_484[ai_0] = gd_672;

SaveMA10(gd_656);

SaveMA21(gd_664);

SaveMA50(gd_672);

}

 

void CheckMA_Angle(int ai_0) {

g_ima_632 = iMA(NULL, 0, MA_Period, 0, g_ma_method_256, MA_AppliedPrice, ai_0 + CurMAShift);

g_ima_640 = iMA(NULL, 0, MA_Period, 0, g_ma_method_256, MA_AppliedPrice, ai_0 + PrevMAShift);

gd_648 = gd_496 * (g_ima_632 - g_ima_640) / 2.0;

gd_648 = NormalizeDouble(gd_648, 2);

SavefAngle(gd_648);

if (gd_648 > AngleTreshold) {

gi_608 = TRUE;

SaveBuy(gi_608);

gs_520 = "BUY";

return;

}

if (gd_648 < -AngleTreshold) {

gi_612 = TRUE;

SaveSell(gi_612);

gs_520 = "SELL";

}

}

 

void CheckHighLowRules(int ai_0) {

if (gi_260 == TRUE) {

if (gi_608) {

if (Low[ai_0] > gd_656) {

gi_608 = FALSE;

SaveBuy(gi_608);

}

}

if (gi_612) {

if (High[ai_0] < gd_656) {

gi_612 = FALSE;

SaveSell(gi_612);

}

}

}

if (gi_264 == TRUE) {

if (gi_608) {

if (High[ai_0] > High[ai_0 + 1]) {

gi_608 = FALSE;

SaveBuy(gi_608);

}

}

if (gi_612) {

if (Low[ai_0] < Low[ai_0 + 1]) {

gi_612 = FALSE;

SaveSell(gi_612);

}

}

}

}

 

void CheckMAs() {

if (gi_608) {

if (gd_656 <= gd_672 || gd_664 <= gd_672) {

gi_608 = FALSE;

SaveBuy(gi_608);

}

}

if (gi_612) {

if (gd_656 >= gd_672 || gd_664 >= gd_672) {

gi_612 = FALSE;

SaveSell(gi_612);

}

}

}

 

string GetSignalTime(int ai_0, bool ai_4) {

if (ai_4) {

if (gi_732 != iTime(NULL, 0, ai_0)) {

g_datetime_536 = TimeCurrent();

gi_736 = g_datetime_536;

SaveLastTradeSignalTime(g_datetime_536);

gi_732 = iTime(NULL, 0, ai_0);

SaveTradeCandleOpenTime(gi_732);

} else g_datetime_536 = gi_736;

} else g_datetime_536 = iTime(NULL, 0, ai_0);

string ls_ret_8 = TimeToStr(g_datetime_536, TIME_DATE) + " " + TimeHour(g_datetime_536) + ":";

if (TimeMinute(g_datetime_536) < 10) ls_ret_8 = ls_ret_8 + "0";

ls_ret_8 = ls_ret_8 + TimeMinute(g_datetime_536);

return (ls_ret_8);

}

 

int GetFacePos(int ai_0) {

int li_ret_4 = 0;

switch (ai_0) {

case 43200:

li_ret_4 = FacePosMN;

break;

case 10080:

li_ret_4 = FacePosW1;

break;

case 1440:

li_ret_4 = FacePosD1;

break;

case 240:

li_ret_4 = FacePosH4;

break;

case 60:

li_ret_4 = FacePosH1;

break;

case 30:

li_ret_4 = FacePosM30;

break;

case 15:

li_ret_4 = FacePosM15;

break;

case 5:

li_ret_4 = FacePosM5;

break;

case 1:

li_ret_4 = FacePosM1;

break;

default:

li_ret_4 = 5;

}

return (li_ret_4);

}

 

void ShowAlert(string as_0) {

string ls_8 = TimeToStr(TimeCurrent(), TIME_DATE) + " " + TimeHour(TimeCurrent()) + ":";

if (TimeMinute(TimeCurrent()) < 10) ls_8 = ls_8 + "0";

ls_8 = ls_8 + TimeMinute(TimeCurrent());

if (Alert_SoundON) Alert(as_0, Symbol(), " on ", tf2txt(Period()), " ", ls_8, " Steinitz");

if (EmailON) SendMail(as_0 + Symbol(), "Date=" + ls_8 + " on " + tf2txt(Period()));

}

 

void ClearArrows() {

for (int li_0 = Bars; li_0 >= 0; li_0--) {

g_ibuf_472[li_0] = 0;

g_ibuf_468[li_0] = 0;

g_ibuf_492[li_0] = 0;

g_ibuf_488[li_0] = 0;

}

}

 

int CheckTradeFilters() {

bool li_4;

bool li_ret_0 = FALSE;

if (gi_84 == TRUE) {

li_4 = FALSE;

if (Year() > gi_96) li_4 = TRUE;

if (li_4 == FALSE) {

if (Year() == gi_96 && Month() > gi_88) li_4 = TRUE;

if (li_4 == FALSE)

if (Year() == gi_96 && Month() == gi_88 && Day() > gi_92) li_4 = TRUE;

}

if (li_4 == TRUE) OutputComment1ToChart("Indicator has expired - renew license");

li_ret_0 = li_4;

}

return (li_ret_0);

}

 

double SetPoint() {

double ld_ret_0;

if (Digits < 4) ld_ret_0 = 0.01;

else ld_ret_0 = 0.0001;

return (ld_ret_0);

}

 

int CheckAccountNumber() {

if (YourAccountNumber == AccountNumber() && YourAccountNumber == gi_76) return (1);

Alert("AccountNumber entered is incorrect.\n You entered ", YourAccountNumber);

return (0);

}

 

void ClearLabels() {

string ls_0 = " ";

OutputLabelToChart(gs_560, gi_548, StatusTxtSize, StatusColor, ls_0, " ");

OutputLabelToChart(gs_568, gi_552, CommentTxtSize, CommentColor, ls_0, " ");

OutputLabelToChart(gs_576, gi_556, CommentTxtSize, CommentColor, ls_0, " ");

}

 

void DeleteBadLabels() {

string l_name_8;

int l_objs_total_4 = ObjectsTotal();

if (l_objs_total_4 > 0) {

for (int li_0 = l_objs_total_4 - 1; li_0 >= 0; li_0--) {

l_name_8 = ObjectName(li_0);

if (StringFind(l_name_8, Symbol(), 0) < 0)

if (StringFind(l_name_8, gs_600, 0) >= 0) ObjectDelete(l_name_8);

}

}

}

 

void DeleteExistingLabels() {

string l_name_4;

int l_objs_total_0 = ObjectsTotal(OBJ_LABEL);

if (l_objs_total_0 > 0) {

for (int l_objs_total_12 = l_objs_total_0; l_objs_total_12 >= 0; l_objs_total_12--) {

l_name_4 = ObjectName(l_objs_total_12);

if (StringFind(l_name_4, Symbol() + gs_600 + "FractalStatus", 0) >= 0) ObjectDelete(l_name_4);

else

if (StringFind(l_name_4, Symbol() + gs_600 + "FractalComment", 0) >= 0) ObjectDelete(l_name_4);

}

}

}

 

void SetupLabels() {

gi_548 = 12;

gi_552 = gi_548 + StatusTxtSize + 4;

gi_556 = gi_552 + CommentTxtSize + 4;

gs_560 = Symbol() + gs_600 + "FractalStatus";

gs_568 = Symbol() + gs_600 + "FractalComment1";

gs_576 = Symbol() + gs_600 + "FractalComment2";

}

 

void OutputLabelToChart(string a_name_0, int a_y_8, int a_fontsize_12, color a_color_16, string a_text_20, string as_unused_28) {

if (ObjectFind(a_name_0) != 0) {

ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0);

ObjectSet(a_name_0, OBJPROP_CORNER, 0);

ObjectSet(a_name_0, OBJPROP_XDISTANCE, Text_X_Offset);

ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_8);

}

ObjectSetText(a_name_0, a_text_20, a_fontsize_12, "Arial Bold", a_color_16);

}

 

void OutputStatusToChart(string as_0) {

OutputLabelToChart(gs_560, gi_548, StatusTxtSize, StatusColor, as_0, "*");

}

 

void OutputComment1ToChart(string as_0) {

OutputLabelToChart(gs_568, gi_552, CommentTxtSize, CommentColor, as_0, "*");

}

 

void OutputComment2ToChart(string as_0) {

OutputLabelToChart(gs_576, gi_556, CommentTxtSize, CommentColor, as_0, "*");

}

 

string tf2txt(int ai_0) {

switch (ai_0) {

case 1:

return ("M1");

case 5:

return ("M5");

case 15:

return ("M15");

case 30:

return ("M30");

case 60:

return ("H1");

case 240:

return ("H4");

case 1440:

return ("D1");

case 10080:

return ("W1");

case 43200:

return ("MN");

}

return ("??");

}

 

void DisplayLine(string as_0, double a_price_8, color a_color_16) {

string l_name_20 = Symbol() + gs_600 + as_0;

if (ObjectFind(l_name_20) != 0) {

ObjectCreate(l_name_20, OBJ_HLINE, 0, g_datetime_464, a_price_8);

ObjectSet(l_name_20, OBJPROP_STYLE, STYLE_DASHDOTDOT);

ObjectSet(l_name_20, OBJPROP_COLOR, a_color_16);

ObjectSet(l_name_20, OBJPROP_WIDTH, 1);

return;

}

ObjectMove(l_name_20, 0, g_datetime_464, a_price_8);

}

 

void DeleteFractObjects() {

ObjectDelete(Symbol() + gs_600 + "FractBuy");

ObjectDelete(Symbol() + gs_600 + "FractSell");

ObjectDelete(Symbol() + gs_600 + "Fib1");

ObjectDelete(Symbol() + gs_600 + "Fib2");

ObjectDelete(Symbol() + gs_600 + "Fib3");

}

 

void RemoveLine(string as_0) {

ObjectDelete(Symbol() + gs_600 + as_0);

}

 

bool CheckBadExit(int ai_0, int ai_4) {

double l_iopen_24 = iOpen(NULL, 0, ai_4);

double l_iclose_40 = iClose(NULL, 0, ai_4);

double l_iopen_32 = iOpen(NULL, 0, ai_4 + 1);

double l_iclose_48 = iClose(NULL, 0, ai_4 + 1);

double l_ima_8 = iMA(NULL, 0, 50, 0, g_ma_method_256, PRICE_CLOSE, ai_4);

double l_ima_16 = iMA(NULL, 0, 50, 0, g_ma_method_256, PRICE_CLOSE, ai_4 + 1);

int li_56 = GetPriceGap(Period());

double ld_60 = li_56 * gd_504;

if (Digits < 3) {

ld_60 = NormalizeDouble(ld_60, 2);

l_iopen_24 = NormalizeDouble(l_iopen_24, 2);

l_iclose_40 = NormalizeDouble(l_iclose_40, 2);

l_iopen_32 = NormalizeDouble(l_iopen_32, 2);

l_iclose_48 = NormalizeDouble(l_iclose_48, 2);

l_ima_8 = NormalizeDouble(l_ima_8, 2);

l_ima_16 = NormalizeDouble(l_ima_16, 2);

} else {

ld_60 = NormalizeDouble(ld_60, 4);

l_iopen_24 = NormalizeDouble(l_iopen_24, 4);

l_iclose_40 = NormalizeDouble(l_iclose_40, 4);

l_iopen_32 = NormalizeDouble(l_iopen_32, 4);

l_iclose_48 = NormalizeDouble(l_iclose_48, 4);

l_ima_8 = NormalizeDouble(l_ima_8, 4);

l_ima_16 = NormalizeDouble(l_ima_16, 4);

}

switch (ai_0) {

case 0:

if (l_iopen_24 > l_iclose_40) {

if (l_iopen_32 > l_iclose_48) {

if (l_iclose_40 + ld_60 <= l_ima_8)

if (l_iclose_48 + ld_60 <= l_ima_16) return (TRUE);

}

}

case 1:

if (l_iopen_24 < l_iclose_40) {

if (l_iopen_32 < l_iclose_48) {

if (l_iclose_40 - ld_60 >= l_ima_8)

if (l_iclose_48 - ld_60 >= l_ima_16) return (TRUE);

}

}

}

return (FALSE);

}

 

int GetPriceGap(int ai_0) {

int li_ret_4 = 0;

switch (ai_0) {

case 43200:

li_ret_4 = PriceGapMN;

break;

case 10080:

li_ret_4 = PriceGapW1;

break;

case 1440:

li_ret_4 = PriceGapD1;

break;

case 240:

li_ret_4 = PriceGapH4;

break;

case 60:

li_ret_4 = PriceGapH1;

break;

case 30:

li_ret_4 = PriceGapM30;

break;

case 15:

li_ret_4 = PriceGapM15;

break;

case 5:

li_ret_4 = PriceGapM5;

break;

case 1:

li_ret_4 = PriceGapM1;

break;

default:

li_ret_4 = 5;

}

return (li_ret_4);

}

 

void GetGlobalVars() {

NameGlobalVars();

InitGlobalVars();

GetGlobalVarValues();

}

 

void GetGlobalVarValues() {

double l_global_var_0 = GlobalVariableGet(g_var_name_740);

if (l_global_var_0 > 0.0) gi_608 = TRUE;

else gi_608 = FALSE;

l_global_var_0 = GlobalVariableGet(g_var_name_748);

if (l_global_var_0 > 0.0) gi_612 = TRUE;

else gi_612 = FALSE;

gd_616 = GlobalVariableGet(g_var_name_756);

gd_624 = GlobalVariableGet(g_var_name_764);

gd_656 = GlobalVariableGet(g_var_name_772);

gd_664 = GlobalVariableGet(g_var_name_780);

gd_672 = GlobalVariableGet(g_var_name_788);

gd_648 = GlobalVariableGet(g_var_name_796);

gi_732 = GlobalVariableGet(g_var_name_804);

gi_736 = GlobalVariableGet(g_var_name_812);

g_global_var_540 = GlobalVariableGet(g_var_name_820);

g_global_var_544 = GlobalVariableGet(g_var_name_828);

gd_696 = GlobalVariableGet(g_var_name_836);

gd_704 = GlobalVariableGet(g_var_name_844);

gd_712 = GlobalVariableGet(g_var_name_852);

}

 

void InitGlobalVars() {

if (!GlobalVariableCheck(g_var_name_740)) GlobalVariableSet(g_var_name_740, -10);

if (!GlobalVariableCheck(g_var_name_748)) GlobalVariableSet(g_var_name_748, -10);

if (!GlobalVariableCheck(g_var_name_756)) GlobalVariableSet(g_var_name_756, 0);

if (!GlobalVariableCheck(g_var_name_764)) GlobalVariableSet(g_var_name_764, 0);

if (!GlobalVariableCheck(g_var_name_772)) GlobalVariableSet(g_var_name_772, 0);

if (!GlobalVariableCheck(g_var_name_780)) GlobalVariableSet(g_var_name_780, 0);

if (!GlobalVariableCheck(g_var_name_788)) GlobalVariableSet(g_var_name_788, 0);

if (!GlobalVariableCheck(g_var_name_796)) GlobalVariableSet(g_var_name_796, 0);

if (!GlobalVariableCheck(g_var_name_804)) GlobalVariableSet(g_var_name_804, 0);

if (!GlobalVariableCheck(g_var_name_812)) GlobalVariableSet(g_var_name_812, 0);

if (!GlobalVariableCheck(g_var_name_820)) GlobalVariableSet(g_var_name_820, 10);

if (!GlobalVariableCheck(g_var_name_828)) GlobalVariableSet(g_var_name_828, 10);

if (!GlobalVariableCheck(g_var_name_836)) GlobalVariableSet(g_var_name_836, 0);

if (!GlobalVariableCheck(g_var_name_844)) GlobalVariableSet(g_var_name_844, 0);

if (!GlobalVariableCheck(g_var_name_852)) GlobalVariableSet(g_var_name_852, 0);

}

 

void NameGlobalVars() {

string ls_0 = "SFBI_15_" + Symbol() + tf2txt(Period());

g_var_name_740 = ls_0 + "_Buy";

g_var_name_748 = ls_0 + "_Sell";

g_var_name_756 = ls_0 + "_BuyLine";

g_var_name_764 = ls_0 + "_SellLine";

g_var_name_772 = ls_0 + "_MA10";

g_var_name_780 = ls_0 + "_MA21";

g_var_name_788 = ls_0 + "_MA50";

g_var_name_796 = ls_0 + "_fAngle";

g_var_name_804 = ls_0 + "_TradeCandleOT";

g_var_name_812 = ls_0 + "_LastTradeCandleST";

g_var_name_820 = ls_0 + "_LastArrow";

g_var_name_828 = ls_0 + "_LastSmile";

g_var_name_836 = ls_0 + "_Fib1";

g_var_name_844 = ls_0 + "_Fib2";

g_var_name_852 = ls_0 + "_Fib3";

}

 

void SaveBuy(int ai_0) {

if (ai_0 == 1) {

GlobalVariableSet(g_var_name_740, 10.0);

return;

}

GlobalVariableSet(g_var_name_740, -10.0);

}

 

void SaveSell(int ai_0) {

if (ai_0 == 1) {

GlobalVariableSet(g_var_name_748, 10.0);

return;

}

GlobalVariableSet(g_var_name_748, -10.0);

}

 

void SaveBuy1(double ad_0) {

GlobalVariableSet(g_var_name_756, ad_0);

}

 

void SaveSell1(double ad_0) {

GlobalVariableSet(g_var_name_764, ad_0);

}

 

void SaveMA10(double ad_0) {

GlobalVariableSet(g_var_name_772, ad_0);

}

 

void SaveMA21(double ad_0) {

GlobalVariableSet(g_var_name_780, ad_0);

}

 

void SaveMA50(double ad_0) {

GlobalVariableSet(g_var_name_788, ad_0);

}

 

void SavefAngle(double ad_0) {

GlobalVariableSet(g_var_name_796, ad_0);

}

 

void SaveTradeCandleOpenTime(int ai_0) {

GlobalVariableSet(g_var_name_804, ai_0);

}

 

void SaveLastTradeSignalTime(int ai_0) {

GlobalVariableSet(g_var_name_812, ai_0);

}

 

void SaveLastArrow(int ai_0) {

GlobalVariableSet(g_var_name_820, ai_0);

}

 

void SaveLastSmile(int ai_0) {

GlobalVariableSet(g_var_name_828, ai_0);

}

 

void SaveFib1(int ai_0) {

GlobalVariableSet(g_var_name_836, ai_0);

}

 

void SaveFib2(int ai_0) {

GlobalVariableSet(g_var_name_844, ai_0);

}

 

void SaveFib3(int ai_0) {

GlobalVariableSet(g_var_name_852, ai_0);

}

Share this post


Link to post
Share on other sites
Below is what I believe to be an open code for the Steinitz fractal breakout strategy. I would like to know if its possible to translate this into easylanguage for tradestation. Please let me know if this is going to work, thank you

...}

 

would you have a sample chart?

what does the indicator do?

 

 

ps: please wrap the code with the code tag. it is the # key at the top of the message window.

Share this post


Link to post
Share on other sites

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.


  • Topics

  • Posts

    • HLF Herbalife stock, watch for a bull flag breakout above 9.02 at https://stockconsultant.com/?HLF
    • Date: 1st April 2025.   Will Gold’s Rally Hold Strong as New Trade Tariffs Take Effect Tomorrow?   Gold continues to increase in value for a sixth consecutive day and is trading more than 17% higher in 2025. Amid fear of higher inflation, a recession and the tariffs war escalating investors continue to invest into Gold pushing demand higher. The trade policy from April 2nd onwards continues to be a key factor for the whole market. Can Gold maintain its upward trend? Trade Policy From Tomorrow Onwards Starting as soon as tomorrow, a 25% tariff will be imposed on all passenger cars imported into the United States. While this White House policy is anticipated to negatively affect European industrial performance, it will also lead to higher transportation and maintenance costs for everyday American taxpayers. The negative impact expected on both the EU and US is one of the reasons investors continue to buy Gold. Additionally, last month, President Donald Trump announced reciprocal sanctions against any trade partners that impose import restrictions on US goods. Furthermore, tariffs on products from Canada and the EU could increase even more if they attempt to coordinate a response. Overall, investors continue to worry that new trade barriers will prompt retaliatory measures, particularly from China, the Eurozone, and Japan. Any retaliation is likely to escalate the trade conflict and prompt another reaction from the US. Experts at Goldman Sachs and other investment banks warn that this will lead to rising inflation and unemployment. They also caution that it could effectively halt economic growth in the US.   XAUUSD 1-Hour Chart   The Weakness In The US Dollar Another factor which is allowing the price of XAUUSD to increase in value is the US Dollar which has been unable to maintain any bullish momentum. Despite last week’s Core PCE Price Index rising to its highest level since February 2024, the US Dollar has been unable to see any significant rise in value. Due to the US Dollar and Gold's inverse correlation, the price of Gold is benefiting from the Dollar weakness. Investors worry that new trade barriers will prompt retaliatory measures from China, the Eurozone, and Japan, potentially escalating the conflict. Experts at The Goldman Sachs Group Inc. believe that such actions by the US administration will drive rising inflation and unemployment while effectively halting economic growth in the country. Can Gold Maintain Momentum? When it comes to technical analysis, the price of Gold is not trading at a price where oscillators are indicating the instrument is overbought. The Relative Strength Index currently trades at 68.88, outside of the overbought area, since Gold’s price fell 0.65% during this morning’s session. However, even with this decline, the price still remains 0.40% higher than the day’s open price. In terms of fundamental analysis, there continues to be plenty of factors indicating the price could continue to rise. However, the price movement of the week will also partially depend on the employment data from the US. The US is due to release the JOLTS Job Vacancies for February this afternoon, the ADP Non-Farm Employment Change tomorrow, and the NFP Change and Unemployment Rate on Friday. If all data reads higher than expectations, investors may look to sell to lock in profits at the high price. Key Takeaway Points: Gold’s Rally Continues – Up 17% in 2025 as investors seek safety from inflation, recession fears, and trade tensions. Trade War Impact – New US tariffs and potential retaliation from China, the EU, and Japan drive uncertainty, boosting Gold demand. Weak US Dollar – The Dollar’s struggle supports Gold’s rise due to their inverse correlation. Gold’s Outlook – Uptrend may continue, but US jobs data could trigger profit-taking. Always trade with strict risk management. Your capital is the single most important aspect of your trading business.   Please note that times displayed based on local time zone and are from time of writing this report.   Click HERE to access the full HFM Economic calendar.   Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE!   Click HERE to READ more Market news.   Michalis Efthymiou HFMarkets   Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in Leveraged Products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • Date: 31st March 2025.   Trump Confirms Tariffs on All Countries, Sending Stocks Lower.   The NASDAQ continues to trade lower due to the US confirming the latest tariffs will be on all countries. In addition to this, bearish volatility also is largely due to the higher inflation data from Friday. The NASDAQ declines to its lowest price since September 11th 2024. Core PCE Price Index - Inflation Increases Again! The PCE Price Index read 2.5% aligning with expert forecasts not triggering any alarm bells. However, the Core PCE Price Index rose from 0.3% to 0.4% MoM and from 2.7% to 2.8% YoY, signalling growing inflationary pressure. This increases the likelihood that the Federal Reserve will maintain elevated interest rates for an extended period. The NASDAQ fell 2.60% due to the higher inflation reading which is known to pressure the stock market due to pressure on consumer demand and a more hawkish Federal Reserve. Boston Fed President Susan Collins recently commented that tariffs could drive up inflation, though the long-term impact remains uncertain. She told journalists that a short-term spike is the most probable outcome but believes the current pause in monetary policy adjustments is appropriate given the prevailing uncertainties. Although, certain investment banks such as JP Morgan actually believe the Federal Reserve will be forced into cutting rates. This is due to expectations that the economy will struggle under the new trade policy. For example, JP Morgan expects the Federal Reserve to delay rate cuts but will quickly cut towards the end of 2025. Market Risk Appetite Takes a Hit! A big factor for the day is the drop in the risk appetite of investors. This can be seen from the VIX which is up almost 6%, Gold which is trading 1.30% higher and the Japanese Yen which is the day’s best performing currency. Most safe haven assets, bar the US Dollar, increase in value. It is also worth noting that all indices are decreasing in value during this morning's Asian session with the Nikkei225 and NASDAQ witnessing the strongest decline. Previously the stock market rose in value as investors heard rumours that tariffs would only be on certain countries. This bullish swing occurred between March 14th and 25th. Over the weekend, President Donald Trump indicated that the upcoming tariffs would apply to all countries, not just those with the largest trade imbalances with the US. NASDAQ - Technical Analysis In terms of technical analysis, the NASDAQ continues to obtain indications that sellers control the price action. The price opens on a bearish price gap measuring 0.30% and trades below all Moving Averages on all timeframes. The NASDAQ also trades below the VWAP and almost 100% of the most influential components (stocks) are declining in value.     The next significant support level is at $18,313, and the resistance level stands at $20,367.95. Key Takeaway Points: NASDAQ falls to its lowest since September 2024 as the US confirms tariffs on all countries, adding to inflation concerns. Core PCE inflation rises to 0.4% MoM and 2.8% YoY, increasing the likelihood of prolonged high interest rates. Investor risk appetite drops as VIX jumps 6%, gold gains 1.3%, and safe-haven assets outperform. NASDAQ shows strong bearish momentum, trading below key technical levels with support at $18,313 and resistance at $20,367.95. Always trade with strict risk management. Your capital is the single most important aspect of your trading business.   Please note that times displayed based on local time zone and are from time of writing this report.   Click HERE to access the full HFM Economic calendar.   Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE!   Click HERE to READ more Market news.   Michalis Efthymiou HFMarkets   Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in Leveraged Products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • PM Philip Morris stock, top of range breakout at https://stockconsultant.com/?PM
    • EXC Exelon stock, nice range breakout at https://stockconsultant.com/?EXC
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.