NexusFi: Find Your Edge


Home Menu

 





WTF is this?


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one sixhundread with 5 posts (2 thanks)
    2. looks_two kevinkdog with 2 posts (3 thanks)
    3. looks_3 ABCTG with 2 posts (2 thanks)
    4. looks_4 SunTrader with 1 posts (2 thanks)
      Best Posters
    1. looks_one SunTrader with 2 thanks per post
    2. looks_two kevinkdog with 1.5 thanks per post
    3. looks_3 ABCTG with 1 thanks per post
    4. looks_4 sixhundread with 0.4 thanks per post
    1. trending_up 2,674 views
    2. thumb_up 9 thanks given
    3. group 3 followers
    1. forum 9 posts
    2. attach_file 2 attachments




 
Search this Thread

WTF is this?

  #1 (permalink)
sixhundread
Vienna and Austria
 
Posts: 36 since Jul 2021
Thanks Given: 21
Thanks Received: 7

Can anyone tell me what this is and how it can be fixed?

Thanks a lot!

Attached Thumbnails
Click image for larger version

Name:	404.PNG
Views:	229
Size:	40.2 KB
ID:	315146  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
What broker to use for trading palladium futures
Commodities
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #2 (permalink)
SunTrader
Boca Raton, FL
 
Posts: 260 since Nov 2018
Thanks Given: 81
Thanks Received: 182


sixhundread View Post
Can anyone tell me what this is and how it can be fixed?

Thanks a lot!

Guess you haven't been using the platform very long?

Go to Format Indicator ---> General tab down in middle:

Maximum number of bars study will reference: and either select

- Auto-Detect
- or a number greater than what your indicator needs plus at least 10 more.

So if you are using a basic moving average (I suggest don't haha) with a length of 9, make bars back at least 19. The greater the bars needed the greater allowance over I would go. Or just use Auto-Detect.

HTH

Reply With Quote
Thanked by:
  #3 (permalink)
sixhundread
Vienna and Austria
 
Posts: 36 since Jul 2021
Thanks Given: 21
Thanks Received: 7



SunTrader View Post
Guess you haven't been using the platform very long?

Go to Format Indicator ---> General tab down in middle:

Maximum number of bars study will reference: and either select

- Auto-Detect
- or a number greater than what your indicator needs plus at least 10 more.

So if you are using a basic moving average (I suggest don't haha) with a length of 9, make bars back at least 19. The greater the bars needed the greater allowance over I would go. Or just use Auto-Detect.

HTH

Thank you very much! I fixed it with yourt advice!!!! THANKS

Reply With Quote
  #4 (permalink)
sixhundread
Vienna and Austria
 
Posts: 36 since Jul 2021
Thanks Given: 21
Thanks Received: 7


SunTrader View Post
Guess you haven't been using the platform very long?

Go to Format Indicator ---> General tab down in middle:

Maximum number of bars study will reference: and either select

- Auto-Detect
- or a number greater than what your indicator needs plus at least 10 more.

So if you are using a basic moving average (I suggest don't haha) with a length of 9, make bars back at least 19. The greater the bars needed the greater allowance over I would go. Or just use Auto-Detect.

HTH

I keep getting this message at another strategie can u tell me what i did wrong here?


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

sixhundread,

according to the error message your code encountered a situation where it attempted to divide by zero. Following the solution in the error message (or using a similar check) for every division that you perform in your code should prevent this.

Regards,

ABCTG


sixhundread View Post
I keep getting this message at another strategie can u tell me what i did wrong here?



Follow me on Twitter Reply With Quote
Thanked by:
  #6 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,360


sixhundread View Post
I keep getting this message at another strategie can u tell me what i did wrong here?


Post your code, and someone can help. It may be an error embedded in a function, not always easy to find, sometimes really easy...

Follow me on Twitter Reply With Quote
Thanked by:
  #7 (permalink)
sixhundread
Vienna and Austria
 
Posts: 36 since Jul 2021
Thanks Given: 21
Thanks Received: 7


kevinkdog View Post
Post your code, and someone can help. It may be an error embedded in a function, not always easy to find, sometimes really easy...

Input: BarNo(0), SL(0), PT(0), MP(0);
Vars: Trigger(0), BSLevel(0), TotTr(0), ExpVar(0), Prof(0), TotProf(0), TradeStr1("");

{****Filters****}
Trigger = Average (C,200);

{****Retracement Entry****}
If C > Trigger and Marketposition = 0 and (L < Average(L, 6)) or
L Crosses above XAverage(L,6) and C Crosses Above XAverage(C,6) and H < XAverage(H,6) Then Begin

Buy ("Buy Support") This Bar at C;
BSLevel = C;
End;


If C < Trigger and Marketposition = 0 and (H > XAverage(H, 6) or H Crosses below XAverage(H, 6)) and C Crosses below XAverage (C, 6) and L > XAverage(L, 6) Then Begin
Sell Short ("Sell Resist") THis Bar at C;
BSLevel = 0;
End;

{****Breakout Entry****}
If C > Trigger and Marketposition = 0 and H Crosses above XAverage(H, 6) and C Crosses above XAverage(C, 6) Then Begin
Buy ("Buy Break") this bar at C;
BSLevel = 0;
End;

IF C < Trigger and Marketposition = 0 and L crosses below XAverage(L, 6) and C Crosses below XAverage(C, 6) Then Begin
Sell Short ("Sell Break") this bar at C;
BSLevel = C;
End;

{****Exit techniques****}
If Barssinceentry >= BarNo and BarNo <> 0 Then Begin
Sell ("Long Time") this bar at C;
Buy to Cover ("Short time") this bar at C;
End;

IF SL <> 0 Then Begin
Sell ("Long loss") Tomorrow at BSLevel*(1 + SL*0.01)Stop;
Buy to Cover ("Short loss") Tomorrow at BSLevel*(1-SL*0.01)Stop;
End;

If PT <> 0 Then Begin
Sell ("Long profit") Tomorrow at BSLevel*(1 + PT*0.01)Limit;
Buy to Cover ("Short profit") Tomorrow at BSLevel*(1-PT*0.01)Limit;
End;

If MP <> 0 Then Begin
IF C > BSLevel*(1+MP*0.01) Then
Sell ("Long stop") Tomorrow at BSLevel*(1+MP*0.01)Stop;

IF C < BSLevel *(1-MP*0.01) Then
Buy to cover ("Short stop") tomorrow at BSLevel*(1-MP*0.01)Stop;

End;



{****beikl****}
TotTr = Totaltrades;
If TotTr > TotTr[1] Then Begin
Prof = Positionprofit(1)/(Entryprice(1)*Bigpointvalue);
TotProf = Totprof + prof;
End;

If LastBarOnChart Then Begin
ExpVar = BarNo;
TotProf = TotProf / Totaltrades;
TradeStr1 = Leftstr(Getsymbolname, 2) + "," + Numtostr(ExpVar, 2) + "," + Numtostr(TotProf*100, 2) + "," + Newline;
Fileappend("C:\Temp\BJ.cvs", TradeStr1);
End;

Reply With Quote
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

sixhundread,

start with the two divisions at the bottom of the code (under "{****beikl****}") and add a logic similar to what the error message suggested.

Regards,

ABCTG



sixhundread View Post
Input: BarNo(0), SL(0), PT(0), MP(0);
Vars: Trigger(0), BSLevel(0), TotTr(0), ExpVar(0), Prof(0), TotProf(0), TradeStr1("");

{****Filters****}
Trigger = Average (C,200);

{****Retracement Entry****}
If C > Trigger and Marketposition = 0 and (L < Average(L, 6)) or
L Crosses above XAverage(L,6) and C Crosses Above XAverage(C,6) and H < XAverage(H,6) Then Begin

Buy ("Buy Support") This Bar at C;
BSLevel = C;
End;


If C < Trigger and Marketposition = 0 and (H > XAverage(H, 6) or H Crosses below XAverage(H, 6)) and C Crosses below XAverage (C, 6) and L > XAverage(L, 6) Then Begin
Sell Short ("Sell Resist") THis Bar at C;
BSLevel = 0;
End;

{****Breakout Entry****}
If C > Trigger and Marketposition = 0 and H Crosses above XAverage(H, 6) and C Crosses above XAverage(C, 6) Then Begin
Buy ("Buy Break") this bar at C;
BSLevel = 0;
End;

IF C < Trigger and Marketposition = 0 and L crosses below XAverage(L, 6) and C Crosses below XAverage(C, 6) Then Begin
Sell Short ("Sell Break") this bar at C;
BSLevel = C;
End;

{****Exit techniques****}
If Barssinceentry >= BarNo and BarNo <> 0 Then Begin
Sell ("Long Time") this bar at C;
Buy to Cover ("Short time") this bar at C;
End;

IF SL <> 0 Then Begin
Sell ("Long loss") Tomorrow at BSLevel*(1 + SL*0.01)Stop;
Buy to Cover ("Short loss") Tomorrow at BSLevel*(1-SL*0.01)Stop;
End;

If PT <> 0 Then Begin
Sell ("Long profit") Tomorrow at BSLevel*(1 + PT*0.01)Limit;
Buy to Cover ("Short profit") Tomorrow at BSLevel*(1-PT*0.01)Limit;
End;

If MP <> 0 Then Begin
IF C > BSLevel*(1+MP*0.01) Then
Sell ("Long stop") Tomorrow at BSLevel*(1+MP*0.01)Stop;

IF C < BSLevel *(1-MP*0.01) Then
Buy to cover ("Short stop") tomorrow at BSLevel*(1-MP*0.01)Stop;

End;



{****beikl****}
TotTr = Totaltrades;
If TotTr > TotTr[1] Then Begin
Prof = Positionprofit(1)/(Entryprice(1)*Bigpointvalue);
TotProf = Totprof + prof;
End;

If LastBarOnChart Then Begin
ExpVar = BarNo;
TotProf = TotProf / Totaltrades;
TradeStr1 = Leftstr(Getsymbolname, 2) + "," + Numtostr(ExpVar, 2) + "," + Numtostr(TotProf*100, 2) + "," + Newline;
Fileappend("C:\Temp\BJ.cvs", TradeStr1);
End;


Follow me on Twitter Reply With Quote
Thanked by:
  #9 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,360


sixhundread View Post
Input: BarNo(0), SL(0), PT(0), MP(0);
Vars: Trigger(0), BSLevel(0), TotTr(0), ExpVar(0), Prof(0), TotProf(0), TradeStr1("");

{****Filters****}
Trigger = Average (C,200);

{****Retracement Entry****}
If C > Trigger and Marketposition = 0 and (L < Average(L, 6)) or
L Crosses above XAverage(L,6) and C Crosses Above XAverage(C,6) and H < XAverage(H,6) Then Begin

Buy ("Buy Support") This Bar at C;
BSLevel = C;
End;


If C < Trigger and Marketposition = 0 and (H > XAverage(H, 6) or H Crosses below XAverage(H, 6)) and C Crosses below XAverage (C, 6) and L > XAverage(L, 6) Then Begin
Sell Short ("Sell Resist") THis Bar at C;
BSLevel = 0;
End;

{****Breakout Entry****}
If C > Trigger and Marketposition = 0 and H Crosses above XAverage(H, 6) and C Crosses above XAverage(C, 6) Then Begin
Buy ("Buy Break") this bar at C;
BSLevel = 0;
End;

IF C < Trigger and Marketposition = 0 and L crosses below XAverage(L, 6) and C Crosses below XAverage(C, 6) Then Begin
Sell Short ("Sell Break") this bar at C;
BSLevel = C;
End;

{****Exit techniques****}
If Barssinceentry >= BarNo and BarNo <> 0 Then Begin
Sell ("Long Time") this bar at C;
Buy to Cover ("Short time") this bar at C;
End;

IF SL <> 0 Then Begin
Sell ("Long loss") Tomorrow at BSLevel*(1 + SL*0.01)Stop;
Buy to Cover ("Short loss") Tomorrow at BSLevel*(1-SL*0.01)Stop;
End;

If PT <> 0 Then Begin
Sell ("Long profit") Tomorrow at BSLevel*(1 + PT*0.01)Limit;
Buy to Cover ("Short profit") Tomorrow at BSLevel*(1-PT*0.01)Limit;
End;

If MP <> 0 Then Begin
IF C > BSLevel*(1+MP*0.01) Then
Sell ("Long stop") Tomorrow at BSLevel*(1+MP*0.01)Stop;

IF C < BSLevel *(1-MP*0.01) Then
Buy to cover ("Short stop") tomorrow at BSLevel*(1-MP*0.01)Stop;

End;



{****beikl****}
TotTr = Totaltrades;
If TotTr > TotTr[1] Then Begin
Prof = Positionprofit(1)/(Entryprice(1)*Bigpointvalue);
TotProf = Totprof + prof;
End;

If LastBarOnChart Then Begin
ExpVar = BarNo;
TotProf = TotProf / Totaltrades;
TradeStr1 = Leftstr(Getsymbolname, 2) + "," + Numtostr(ExpVar, 2) + "," + Numtostr(TotProf*100, 2) + "," + Newline;
Fileappend("C:\Temp\BJ.cvs", TradeStr1);
End;


Seems like this strategy, with default settings, takes 0 trades or (in the case I ran) 1 trade that never closed.

So, change the last section of code to:

If LastBarOnChart Then Begin
ExpVar = BarNo;
TotProf=0;
If TotalTrades>0 then TotProf = TotProf / Totaltrades;
//TotProf = TotProf / Totaltrades;
TradeStr1 = Leftstr(Getsymbolname, 2) + "," + Numtostr(ExpVar, 2) + "," + Numtostr(TotProf*100, 2) + "," + Newline;
Fileappend("C:\Temp\BJ.cvs", TradeStr1);
End;



And it will work. But, now the issue is why is it not generating trades. That is something you'll have to figure out...

Follow me on Twitter Reply With Quote
Thanked by:
  #10 (permalink)
sixhundread
Vienna and Austria
 
Posts: 36 since Jul 2021
Thanks Given: 21
Thanks Received: 7



kevinkdog View Post
Seems like this strategy, with default settings, takes 0 trades or (in the case I ran) 1 trade that never closed.

So, change the last section of code to:

If LastBarOnChart Then Begin
ExpVar = BarNo;
TotProf=0;
If TotalTrades>0 then TotProf = TotProf / Totaltrades;
//TotProf = TotProf / Totaltrades;
TradeStr1 = Leftstr(Getsymbolname, 2) + "," + Numtostr(ExpVar, 2) + "," + Numtostr(TotProf*100, 2) + "," + Newline;
Fileappend("C:\Temp\BJ.cvs", TradeStr1);
End;



And it will work. But, now the issue is why is it not generating trades. That is something you'll have to figure out...

Thanks it worked out so far!


I got this code aswell it generates Trades, but only if you change to timeframe to daily and 20 years back!


Input: BarNo(0), SL(0), PT(0), MP(0);
Vars: Trigger(0), BSLevel(0), TotTr(0), ExpVar(0), Prof(0), TotProf(0), TradeStr1("");

{****Filters****}
Trigger = Average (C,200);

{****Retracement Entry****}
If C > Trigger and Marketposition = 0 and (L < Average(L, 6)) or
L Crosses above XAverage(L,6) and C Crosses Above XAverage(C,6) and H < XAverage(H,6) Then Begin

Buy ("Buy Support") This Bar at C;
BSLevel = C;
End;


If C < Trigger and Marketposition = 0 and (H > XAverage(H, 6) or H Crosses below XAverage(H, 6)) and C Crosses below XAverage (C, 6) and L > XAverage(L, 6) Then Begin
Sell Short ("Sell Resist") THis Bar at C;
BSLevel = 0;
End;

{****Breakout Entry****}
If C > Trigger and Marketposition = 0 and H Crosses above XAverage(H, 6) and C Crosses above XAverage(C, 6) Then Begin
Buy ("Buy Break") this bar at C;
BSLevel = 0;
End;

IF C < Trigger and Marketposition = 0 and L crosses below XAverage(L, 6) and C Crosses below XAverage(C, 6) Then Begin
Sell Short ("Sell Break") this bar at C;
BSLevel = C;
End;

{****Exit techniques****}
If Barssinceentry >= BarNo and BarNo <> 0 Then Begin
Sell ("Long Time") this bar at C;
Buy to Cover ("Short time") this bar at C;
End;

IF SL <> 0 Then Begin
Sell ("Long loss") Tomorrow at BSLevel*(1 + SL*0.01)Stop;
Buy to Cover ("Short loss") Tomorrow at BSLevel*(1-SL*0.01)Stop;
End;

If PT <> 0 Then Begin
Sell ("Long profit") Tomorrow at BSLevel*(1 + PT*0.01)Limit;
Buy to Cover ("Short profit") Tomorrow at BSLevel*(1-PT*0.01)Limit;
End;

If MP <> 0 Then Begin
IF C > BSLevel*(1+MP*0.01) Then
Sell ("Long stop") Tomorrow at BSLevel*(1+MP*0.01)Stop;

IF C < BSLevel *(1-MP*0.01) Then
Buy to cover ("Short stop") tomorrow at BSLevel*(1-MP*0.01)Stop;



End;



{****beikl****}
TotTr = Totaltrades;
If TotTr > TotTr[1] Then Begin
Prof = Positionprofit(1)/(Entryprice(1)*Bigpointvalue);
TotProf = Totprof + prof;
End;

If LastBarOnChart Then Begin
ExpVar = BarNo;
TotProf = TotProf / Totaltrades;
TradeStr1 = Leftstr(Getsymbolname, 2) + "," + Numtostr(ExpVar, 2) + "," + Numtostr(TotProf*100, 2) + "," + Newline;
Fileappend("C:\Temp\BJ.cvs", TradeStr1);
End;

{*****Zeit-/Trailingstop*****}

If Barssinceentry >= BarNo Then Begin
Sell ("Exit Long Time") Tomorrow at C Stop;
Buy to Cover ("Exit Short Time") Tomorrow at C stop;

End;

Reply With Quote
Thanked by:




Last Updated on July 19, 2021


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts