Click here to Login





                                                   Using Optimize()

  0

0
Jeff D
2014-01-16 20:53:35


If I use Optimize to test different parameters for a variable I noticed there is Variable Name, Min, Max, Step but no default value. If I set the min max and step it works fine for the Optimize but how to I set a default value for when I RUN the system it will take that value?

Thanks



Alexander Horn
2014-01-16 21:06:10

  0

Best Answer
Hi Jenkisan,

I'm also used to the Amibroker version with Default setting, but here how you can simulate. Simply put opti=0 to fix some values for one run, or =1 to optimize, see below. Hope it helps..

Btw, I'm also working on ranking rules like EtfReplay, Accutrack, IDB, send me a PM if you want to exchange....

Best,
Alex


// Optimize settings -- Opti = 0 means fix best values, 1 means optimize
opti = 0;

Assets = 1;
LT = 142;
ST = 32;

Optimize("Assets", iff(opti,1, assets), iff(opti,5, assets), 1);
Optimize("LT", iff(opti,2, LT), iff(opti,162, LT), 10);
Optimize("ST", iff(opti,2, ST), iff(opti,162, ST), 10);

// your rules..



Jeff D
2014-01-16 21:09:15

  0

Thanks Alex

Merci.



Jeff D
2014-01-23 12:46:00

  0

Alex,

to follow up on your great script above, I added 2 more variables but these don't seem to work. They are long (decimals), does this make a difference? Do I need to declare them as such? When I run the simulation all I get is

weight1 = 0 and weight2 = 0 instead of 0.5 and 0.5

PS If I set to 1 and optimize it works fine. Only when I set to 0 so I can use my own value that it doesn't accept the 0.5.

Thanks

volopti = 0;
rocopti = 0;
w1opt = 0;
w2opt = 0;

volper = 20; //20 50
rocper = 120; //125 130
weight1 = 0.5;
weight2 = 0.5;



Optimize("volper", iff(volopti,10,volper), iff(volopti,250,volper), 5); // Create an optimizable period natr
Optimize("rocper", iff(rocopti,10,rocper), iff(rocopti,250,rocper), 5); // Create an optimizable period roc
Optimize("weight1", iff(w1opt,0.1,w1opt), iff(w1opt,1,w1opt), 0.1); //weight 1
Optimize("weight2", iff(w2opt,0.1,w2opt), iff(w2opt,1,w2opt), 0.1); //weight 2



QuantShare
2014-01-23 12:49:19

  0

Replace the last two lines by:

Optimize("weight1", iff(w1opt,0.1,weight1 ), iff(w1opt,1,weight1 ), 0.1); //weight 1
Optimize("weight2", iff(w2opt,0.1,weight2), iff(w2opt,1,weight2), 0.1); //weight 2




Jeff D
2014-01-24 12:50:12

  0

I see! Stupid mistake on my behalf.


No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Stock market prediction using traderbots
Market Volatility - Composite Indicator using Stocks Standard Dev...
Put-Call Ratio Index using Market Makers Trades
Trading rules using the VIX Index
Stock Ranking using Rate of Change and SMA Volume

How-to Lessons
How to draw an horizontal segment line using QS language
How to plot a stock using different periods in the same chart
How to calculate the average of a time series using the money man...
How to debug a trading system using the money management tool
How to get stocks for a particular index using the global script

Related Forum Threads
Can I update the sector and industry information in the stock dat...
Backtesting: Using lookback money management feature
Problem drawing trend line using version 2.91
Connecting to Interactive brokers using API
Trading System using multiple time frames

Blog Posts
Technical Analysis Using Multiple Timeframes - Second Part
Backtesting chart patterns using the auto support and resistance ...
Forecast volatility using trading rules and neural networks
Trading Items: Data Download using .Net Scripts
How to create market indicators using the composite function - Pa...









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.