How to count SCORM interactions? - interaction

I don't know how to get a score when using SCORM. I have the interaction information i guess, but how do I set the max, min, raw? There is 1 multiple choice question worth 100 points(for testing).
submitMCQ(correct, response) {
let nextIndex = SCORM.get("cmi.interactions._count", true);
//record interaction id
SCORM.set("cmi.interactions." + nextIndex + ".id", "round_" + nextIndex);
//record interaction type
SCORM.set("cmi.interactions." + nextIndex + ".type", "choice");
//record interaction of students choice
SCORM.set("cmi.interactions." + nextIndex + ".student_response", response);
//record interaction of correct choice
SCORM.set("cmi.interactions." + nextIndex + ".result", correct);
//HOW TO GET SCORE FROM CORRECT CHOICES?
},

Commonly you could have a objective(s) aligned to the interaction which has a spot for scoring.
https://github.com/cybercussion/SCOBot/blob/master/QUnit-Tests/js/scorm/SCOBot.js#L868
You can roughly see how I dealt with looping thru that to assist at the content API level since SCORM is entirely a single key/value get per request.
I designed SCOBot around 2009 as I witnessed so much code duplication occurring among teams, and at the time utilized more advanced features of SCORM. Most the other options at the time were either too expensive, or did not wrap a lot of this SCORM communication which left developers fending for themselves.
This project was mainly broke up into base SCORM communication, and then the SCOBot add on wraps all the common tasks to aid in making those interactions easier. And there is actually have a Wiki on that project if you have deeper questions.
https://github.com/cybercussion/SCOBot/wiki

Related

For a particular pair, how to get a total volume of open Long and Short positions on The Exchage?

In MQL4 ( MT4, MT5 ), how do I get the total volume of open Short and Long positions on the Exchange, for a current pair at the current time?
A thing, you ask to get, is called a Level-3 Depth-of-Market, [L3-DoM].
Fact 1: there is not a common way to aggregate the Global DoM, may expect just a per Exchange ( a local, market-making, island ) Local DoM, so forget about seeing anything near the orders of magnitude of the average Global FX turnover, published to be about USD 5,400,000,000,000.00
Fact 2: even the local market-making body ( FX Trading Venue, LP provider, FX Broker et al ) do not expect to receive the Local DoM automatically, as not all bodies aggregate & provide the Local DoM on some public service-provisioning basis.
Fact 3: given some streaming interfaces can provide a Trader a flow of changes on the DoM, one ought expect using a high-frequency processing tools, to handle more than small/large tens ( hundreds/thousands even tens of thousands in peak hours alike NFP events, etc. ) changes per millisecond to happen. Given a professional trading venue is well oiled with sufficient peering with Prime Banks, Institutional LPs ( and perhaps a few DarkPool LPs ), the majors execute in common a Local DoM in the ranges above USD 50,000,000.00 on each of Long and Short sides.
Fact 4: some older updates of MetaTrader Terminal 4 started an add-on panel, called similarly a DoM, but there were no programmatic ways to communicate with such add-on panel/data. More details on this part of history are here.
Fact 5: The proposal, presented in his fairest belief by Daniel, does not provide DoM per-se, but show just your ( a Trader's ) own inventory of positions, placed on the table, not the real DoM landscape.
If interested in more details, do not hesitate to read more posts on DoM and some other animated latency graphs on Top-of-the-Book Price Lifetime to be able to compare FX Brokers timings against LMAX, Currenex or other LP-providers. For detailed LDG/GDF statistics on speed of changes in the L3-DoM near/during NFP announcement, enjoy the data collected in a Table aggregates from FIX-Protocol Stream Processing, presented in this post.
in mt5 - depends on your terminal, if you select non-hedging then total open position for each Symbol.
in mt4 - use the following code, if you are interested in trades open by some particular EA - then check both Symbol and magic number:
int buys = 0, sells = 0; //number of tickets
double volBuys = 0, volSells = 0; //total volumes
for (int i=OrdersTotal()-1;i>=0;i--){
if(OrderSelect(i,SEL_BY_POS)){
if(OrderSymbol()==Symbol()){
if(OrderType()==OP_BUY){
buys++;
volBuys += OrderLots();
}else if(OrderType()==OP_SELL){
sells++;
volSells += OrderLots();
}
}
}
}

Using Symbols while coding

What does the different symbols mean when coding? such as * < > != # and why are they needed? how do I know which ones to use. and Which words to use to begin a code like including a save option? I have read the course work downloaded additional Wiki docs. Python.org tutorials and I have not found any answers to my questions.
They are called operators, and they perform some operation on the values associated with them (known as operands). For example, 1 * 2 means to multiply (operator *) 1 and 2 (the operands) and return the product.
You should seek more intensive programming education before attempting to implement a save option. Your question is very basic and indicates that you are still learning the basics. Keep at it! The greatest writers of all time once had to spend time learning their ABC's and how to sound out words.

Why memory leaks with a dynamic array of a custom class?

I'm creating a indicator that recognizes candlestick shapes.
To do that I created a separate class Candlestick that I include to the indicator file.
The problem is that I suffer from memory leaks.
I'm new to pointers and after reading / watching a lot, I still seem to miss something here.
This is the Indicator class. The content of the Candlestick class is irrelevant so I leave that out.
Candlestick *candles[];
void OnDeinit(const int reason)
{
for(int i = 0; i < ArraySize(candles); i++ ){
delete(candles[i]);
}
}
int OnCalculate(args here)
{
ArrayResize(candles, Bars);
for(int i = MathMax(Bars-2-IndicatorCounted(), 1); i >= 0; i--)
{
candles[i] = new Candlestick();
// Do stuff with this candle (and other candles) here e.g.
if(candles[i+1].type == BULLISH) Print("Last candle was Bullish");
}
}
When I do this I get memory leak errors. It seems that I need to delete the pointers to the candles in that dynamic array. The problem is, when and where? Because I need them in the next iteration of the for(){...} loop. So I can't delete it there.
When I delete it in the OnDeinit() function there are still candles out there and I still get the leak error.
How come?
First, Nick, welcome to the Worlds of MQL4
You might have already realised, the MQL4 code is not a C.
Among many important differences, the key here is what does the code-execution platform ( the MetaTrader Terminal 4 ) do in what moment.
OnCalculate() is a zombie-alike process, which gets invoked many times, but anyway, definitely not under your control.
Next, OnCalculate() by-design does not mean a new Bar.
How to?
MQL4 conceptually originates from days, when computing resources were many orders smaller and much more expensive in terms of their time-sharing CPU-MUX-ing during a code execution phase.
Thus the MQL4-user-domain language retains benefits from some hidden gems, that are not accessible directly. One of these is a very efficient register-based update-processing and keeping dynamic resources allocations on miminum, for their devastatingly adverse effects on Real-Time execution predictability.
This will help you understand how to design & handle your conceptual objects way smarter, best by mimicking this "stone-age"-but-VERY-efficient behaviour ( both time-wise & memory-wise ), instead of flooding your memory-pool with infinite amount of unmanaged instances upon each call of OnCalulate() which sprinkles an endless count of new Candlestick(); // *--> candles[]
A best next step:
If in doubts, just read about best practices for ArrayResize() in the platform localhost-help/documentation, to start realise the things, that introduce overheads ( if not blocks ) in a domain, where nano$econd$ count & hurt in professional software design.

iOS App Development with SEC Edgar/Xbrl Integration

I am working on building an iOS app in Objective-C that requires data to be pulled from the SEC's Edgar Filings database. How can I integrate a search field into my code that would call on a specific company's financial statement information to display in the app? Any helpful advise or resources would be greatly appreciated. Thanks.
Using CIK is probably the best way to search for specific company filings.
One way is to have your app screen scrape the results using some of the functions available in WebKit like evaluateJavaScript. Pulling information from income statements and identifying the individual income statement line items would be very difficult because the labels would be inconsistent among companies.
In your code, you could format the http web string for an Edgar 10-K filing which contains the income statement like so
let CIK="1652044"
let SECFormName = "Form10K"
let URLStr = "https://www.sec.gov/cgi-bin/browse-edgar?company=&CIK=" + CIK + "&type=" + SECFormName + "&owner=include&count=40&action=getcurrent"
The above is in Swift syntax and conversion to Objective C is minor.

DSP-type effects in realtime on the C64: How is it possible?

I just saw this, and it is one of the most amazing things I've ever seen:
http://www.youtube.com/watch?v=MDrqBYkco-Y
I am not even able to fathom this. What is going on here?
This paper provides an in-depth explanation of what is going on. The primary technique is voice compression that works the same was as a music sequencer, or tracker, but tailored for voice. This makes it somewhat easy to do pitch and velocity adjustments (since, that's what a tracker does). Throw in some typical C64 trickery to synchronize everything and utilize every CPU cycle.
I've done four-voice wave-table synthesis on an Atari 2600. Outputting one sample every 76 CPU cycles--46 cycles for music and 30 cycles for display and other stuff. Each sample had to do essentially the following:
out1 = table1[phase1] + table2[phase2];
out2 = table3[phase3] + table4[phase4];
phase1 = (phase1 + freq1) mod length1;
phase2 = (phase2 + freq2) mod length2;
phase3 = (phase3 + freq3) mod length3;
phase4 = (phase4 + freq4) mod length4;
The carry flag must be clear on entry to the sample-generation code, and will be clear on exit. The Y register and accumulator may be anything on entry, and will be trashed on exit. The X register is not used.
I would guess the Cubase demo for the 64 has each phoneme looped using a tracker, and then uses some fairly simple code for the echo effect, while using the C64's hardware filtering and volume control for the filter and volume effects.

Resources