NexusFi: Find Your Edge


Home Menu

 





Power Language Takes so long to load and calculate


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one risaldeb with 2 posts (0 thanks)
    2. looks_two program with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 ABCTG with 1 posts (0 thanks)
    1. trending_up 1,668 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

Power Language Takes so long to load and calculate

  #1 (permalink)
risaldeb
Hong Kong
 
Posts: 10 since Feb 2015
Thanks Given: 1
Thanks Received: 0

After loading the The power language below into multicharts it took forever to calculate and load. I wonder what went wrong. Please help... THanks.


[IntraBarOrderGeneration=TRUE]

Input:

TradeCost (1000),
TradeTimeStart (0900),
TradeTimeEnd (1500),
AccFactorStep( 0.14 ),
AccFactorLimit( 0.2 ),
BreakEvenPct (10),
StopLossPct (10),
dailyloss (3000),
DMIP (14),
ADXlen (14);

Variables:

TradeOK (false), //Trade
TrdQty (0), // Number of Contracts
StopAmt (0),
ActualCost (0),
EntryPrice (0),
Position (0),
//SetBreakEven (0),
FloorAmt (0),
//SetStopLoss (0),
Value1 (0),
Value2(0),
Value3 (0),
todaynet (0),
yesterdaynet (0),

oParCl( 0 ), oParOp( 0 ), oPosition( 0 ), oTransition( 0 ) ;

Value1 = ParabolicSAR( AccFactorStep, AccFactorLimit, oParCl, oParOp, oPosition, oTransition ) ;
Value2 = ADX(ADXlen);
Value3 = DMIPlus (DMIP);

// TrdQty = IntPortion(TradeCost/(100*Close));// Round off the entry contracts.
Position = IntPortion(TradeCost/(100*EntryPrice)); //Actual Position Contracts.
ActualCost = Position * EntryPrice * 100;
StopAmt = ActualCost * StopLossPct/100;

FloorAmt = ActualCost * (BreakEvenPct/100);

{Determine if current time is within valid market session by setting
the TradeOK to TRUE which will allow new position to be opened (traderslaboratory.com)}

if (Time > TradeTimeStart) AND (Time < TradeTimeEnd) then
TradeOK = True;

If date <> date [1] then begin
yesterdaynet = NetProfit;
end;
if MarketPosition = 0 then begin
todaynet = NetProfit - yesterdaynet;
condition1 = -dailyloss < todaynet;

// Buy if SAR -1, DMI >15

If (TradeOK) And (MarketPosition=0) And (oPosition = -1)
And (Value2>15) And (Value3 >20) And (condition1 = True) Then Begin

Buy ( "Buy-SAR" ) Next Bar {TrdQty Contracts} at Market;

// Set Stops.
//SetStopPosition;
SetStopLoss(StopAmt);
SetBreakEven (FloorAmt);

End;


// Sell for Profit if SAR = +1

If (MarketPosition=1) And (oPosition = 1) Then Begin

Sell ( "Sell" ) Next Bar at Market;

End;



If (TradeOK = False) And (MarketPosition=1) Then Begin
Sell ( "SellTime" ) Next Bar at Market;
End;
End;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
Deepmoney LLM
Elite Quantitative GenAI/LLM
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
Battlestations: Show us your trading desks!
26 thanks
The Program
17 thanks
  #3 (permalink)
risaldeb
Hong Kong
 
Posts: 10 since Feb 2015
Thanks Given: 1
Thanks Received: 0


I hope someone will reply please.

Reply With Quote
  #4 (permalink)
 
program's Avatar
 program 
CA USA
 
Experience: Intermediate
Platform: MultiCharts
Broker: DDT+land/Rithmic/IQ
Trading: S&P500,6E,YM
Posts: 99 since Nov 2010
Thanks Given: 127
Thanks Received: 64


risaldeb View Post
I hope someone will reply please.

Your "EntryPrice" variable is causing a division by zero error Set the initial variable value to something other than "(0)". then maybe add something like:
 
Code
if entryprice = 0 then EntryPrice = EntryPrice[1];
Honestly, i have no idea what your trying to do with the code but that's the first thing that jumped out at me.
Also, you will get alot more help at Multicharts discussion Forum
hope this helps you, good luck.

I have approximate answers, possible beliefs and different degrees of certainty of different things. But I'm not absolutely sure of anything and there are many things i don't know anything about.
Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

risaldeb,

what makes it very hard to help you is the amount of information you provided besides your script.
For example what does "forever" mean - seconds, minutes, hours... eternity? How many days of data did you load on what symbol and timeframe? What were your settings for the bar magnifier? There are so many variables that could explain why code took a while to calculate. With your code not being overly complex I would expect the reason to be somewhere to be found within the points I mentioned.

Regards,
ABCTG

Follow me on Twitter Reply With Quote




Last Updated on April 14, 2015


© 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