I have a code with some initial settings... see eg below
//---------------------------------------- Initial Capital & Risk ----------------------------------------//
SetOption("InitialEquity", 12000000);
SetOption( "UsePrevBarEquityForPosSizing", 1 ); //*set the use of last bars
SetOption("MinPosValue",10000); // min value of shares to purchase //
RiskPerShare = 3 * ATR( 14 ); //Risk Per share //
PositionRisk = 5; // risk 5% of entire equity on single trade //
PctSize = PositionRisk * BuyPrice / RiskPerShare; // position size calculation - no of shares//
SetPositionSize( PctSize, spsPercentOfEquity ); //set position size)
SetOption( "AllowPositionShrinking", True ); // Shrink Position on Loss //
RoundLotSize = 1; // Lot Size //
SetOption("RefreshWhenCompleted",True); // Refresh when completed //
//--------------------------------------------------------------------------------------------------------//
//--------------------------------------------- COMMISSIONS ----------------------------------------------//
SetOption("CommissionMode", 1); // Percent Mode
SetOption("CommissionAmount",0.25); // 0.25% of Trade Value
//--------------------------------------------------------------
my Question is how do i hard code the below Backtest General Settings in AFL ?
positions (long/short/both)
periodicity - i tried setoption("periodicity", indaily); --- didnt work
Futures mode
Pad and align ref data
annual fixed int rate
account margin
apart from this would also like to hard code
Limit trade size as % of entry and 2. i do not want to include stocks or sectors with no volume data
Would really appreciate if anyone could guide me in the right direction pls.
Just save your .APX project file (File->Save from main menu when Analysis window is open). This will save your formula AND all settings in one file. Such file can be also sent to other person/computer and he/she will have same formula and settings that way.
Since we are talking about settings, I also would like to raise a point please.
Actually there is one key setting where APX file does not save the relevant setting: Here the point refers to FX conversion settings in preferances where functional currency of the report could be defined.
What would really make it practical, if APX file also captures this FX conversion settings.
So far these FX settings are global to Amibroker & what would make life easier, if these could be amended in such a way to be saved down within the APX file.
In UK location due to legislation/regulation we have two types of brokers. First, usual brokers all traders use globally. Second, spread betting ones. The latter provides accounts on one currency only. For instance, you can run all instruments in EUR or GBP irrespective of the underlying currency of the futures contract. So these types of brokers transfer FX risk from trader to themselves.
To Test same strategy with these two different brokers requires continues alignment of FX conversion rates within Preferences.
If APX file would have saved these conversion rates then one APX file could be used for one type broker and second APX file for the other.
I do have a feeling that I will not get what I ask for in the short run but put it out there so requirement would be known for UK clients.